You will need to make a new String based off the old one. Since you need to capture every letter and reverse its position, I would recommend using some sort of loop. A for loop or a for each loop would likely be good choices. Some valuable methods you might want to use on the String is str.charAt(x) which retrieves the letter at x position, and str.substring(x,y) which takes a substring of the str from x to y.
One way of doing it would be the following:
- Start a loop from the length of the string - 1 (which is the end of the string)
- Get the character at the loop position
- Append that character onto a new String
- Continue loop going backwards until you reach the i < 0 iteration.
Generally speaking the string reversal assignment is given when the teacher it talking about recursion. It is a classic and very simple exercise to reverse a string using recursion. If the instructor was taking about recursion when he/she gave the assignment, I strongly suggest you use recursion to complete the assignment.
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH