How do I print a word backwards using Java? | Sololearn: Learn to code for FREE!

0

How do I print a word backwards using Java?

9/18/2020 8:07:32 PM

Manuji John

11 Answers

New Answer

+3

Using StringBuilder wrapper String word = "Hello world!"; String reversed = new StringBuilder(word) .reverse() .toString();

+1

But how?

+1

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..

+1

I don't know but l will try God helping me

+1

Thank you

+1

EliSucco if you are asking question then, condition shloud be i >= 0 to print first char also...

0

You can use a loop to track from backwards simply..

0

What ever you know, try by that first and post your try to know your understandings.. So that others help to complete the task....

0

Ok thanks

0

String s = "Hello, World!"; char[] cArr = s.toCharArray(); for (int i = cArr.length - 1; i >= 0; i--) { System.out.println(cArr[i]); }