11 Answers
New AnswerUsing StringBuilder wrapper String word = "Hello world!"; String reversed = new StringBuilder(word) .reverse() .toString();
Did you completed the loop chapter? If yes then can you show me to print a string charecter one by one.. Or post any attempt for that.. If you not completed the lessons for strings and loops then just complete first.. Don't jump farward.. You can not understood, even if I say the way, also..
EliSucco if you are asking question then, condition shloud be i >= 0 to print first char also...
What ever you know, try by that first and post your try to know your understandings.. So that others help to complete the task....
String s = "Hello, World!"; char[] cArr = s.toCharArray(); for (int i = cArr.length - 1; i >= 0; i--) { System.out.println(cArr[i]); }
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message