Reverse String in Java Example

Posted on Updated on

We often come across a situation, where we have to reverse String. In some situation we have to reverse String character by character while in some situations we have to reverse String word by word. Let us see examples.

1) Reverse String character by character

Output

Reverse String character by character using StringBuilder

Output

2) Reverse String word by word

Output

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.