Java program to reverse a String

In this post,  we will see java program to reverse a String.
There are many ways to do it, some of them are:

  • Using for loop
  • Using recursion
  • Using StringBuffer

Using for loop:

When you run above program, you will get following output:

Using recursion:

When you run above program, you will get following output:

Using StringBuffer:

When you run above program, you will get following output:

Please go through java interview programs for more such programs.

Add Comment