Java Examples

100+ tutorials, source code, and examples to help you develop creative and technical skills.

Reverse A String Using Static Method in Java

ReverseofaString.java

/* Code From Learnoset - Learn Code Online Android App.*/
/*Download Learnoset App from PlayStore to learn coding*/

import java.util.Scanner;

class ReverseofaString
{
	public static void main(String[] arg)
	{
	ReverseofaString rev=new ReverseofaString();
	Scanner sc=new Scanner(System.in);
	System.out.print("Enter a string : ");
	String  str=sc.nextLine();	
	System.out.println("Reverse of a String  is : "+rev.reverse(str));
	}
static String reverse(String s)
	{
	String rev="";
	for(int j=s.length();j>0;--j)
	{
	rev=rev+(s.charAt(j-1)); 
	}
	return rev;
	}
}

/*----------OUTPUT-------------*/
/*Enter a string : Learnoset
Reverse of a String  is : tesonraeL*/

Projects with Source Code + Video Tutorials

You can download our Java and Android Studio Projects with Source Code and Video Tutorials.

Settings-and-Profile-page-UI-design-in-Android-Studio-with-Example-and-Source-Code
Settings and Profile page UI design in Android Studio with Example and Source Code
How-to-create-custom-Update-Dialog-with-Example-in-Android-Studio
How to create custom Update Dialog with Example in Android Studio
Spin-and-Win-App-for-Android-(Offline-Version)
Spin and Win App for Android (Offline Version)

If you have any Questions or Queries
You can mail us at info.learnoset@gmail.com

Follow us to learn Coding and get in touch with new Technologies.