-->

9/19/2019

Write a Java Program to reverse a string without using String inbuilt function.

Here, we are initializing a string variable str and are making use of the string builder class

1public class FinalReverseWithoutUsingStringMethods {
2 
3          public static void main(String[] args) {
4                   // TODO Auto-generated method stub
5                   String str = "Automation";
6                   StringBuilder str2 = new StringBuilder();
7                   str2.append(str);
8                   str2 = str2.reverse();     // used string builder to reverse
9                   System.out.println(str2);
10          }
11 
12}
Output:
noitamotuA
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post