I want to reverse each individual word of a String in Java (not the entire string, just each individual word).
Example: if input String is "Hello World" then the output should be "olleH dlroW".
I want to reverse each individual word of a String in Java (not the entire string, just each individual word).
Example: if input String is "Hello World" then the output should be "olleH dlroW".
Easy way:
Using only
substring()
and recursion: