Skip to content

Commit 170044d

Browse files
authored
Merge pull request ashutosh97#111 from JacobStewart20/ReverseChars
ReverseChars program in java!
2 parents bb159f3 + 846d3b7 commit 170044d

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

ReverseChars/ReverseChars.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
class main {
2+
3+
public static void main(String[] args){
4+
5+
System.out.println(reverseChars("These Chars will be in reverse"));
6+
7+
}
8+
9+
public static String reverseChars(String reverseIt) {
10+
11+
int stringLength;
12+
String itReversed;
13+
14+
reverseIt = reverseIt;
15+
16+
stringLength = reverseIt.length();
17+
itReversed = "";
18+
19+
for (int i = 1; i <= stringLength; i++){
20+
char backwardChars = reverseIt.charAt(stringLength - i);
21+
22+
itReversed += backwardChars;
23+
}
24+
return itReversed;
25+
}
26+
}

ReverseChars/problem.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a program that takes a given string and loops through the string and places each character in reverse!

0 commit comments

Comments
 (0)