dark_mode

How to Reverse a String in Java programming language




Example



                                                              
//By GadTool.blogspot.com
import java.util.Scanner;
class
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter your text:");
String GadTool=sc.nextLine();
StringBuilder GadTool_Blogspot_com=new StringBuilder(GadTool);
GadTool_Blogspot_com.reverse();
System.out.println("Here is the reversed form:\n"+GadTool_Blogspot_com);
}
}

➡️ Enter the name of the class in which you are typing or pasting the above code.

Post a Comment

1 Comments

Translate