Reverse a String in Java

A string is a sequence of characters. In java, objects of String are immutable which means a constant and cannot be changed once created. Initialize an empty string to the reversedString . String reverse in java using for loop. In this article, you will learn how to make a java program to reverse a string using for loop. A for loop is a repetition control structure which allows us to write a loop that is executed a specific number of times.

Source Code

public class Reverse {
    public static void main(String args[])
        //Program to reverse a given string
        StringBuilder a = new StringBuilder("Tutor Joes Computer Education");
        StringBuilder b=new StringBuilder();
        for(int i=a.length()-1;i>=0;i--)


Tutor Joes Computer Education
noitacudE retupmoC seoJ rotuT
To download raw file Click Here

Basic Programs