0% found this document useful (0 votes)
3 views1 page

Java Program to Reverse a String

This Java program defines a class called ReverseString that reverses a given string. It initializes a string 'name', calculates its length, and uses a for loop to build the reversed string. Finally, it prints the reversed string to the console.

Uploaded by

sumeet
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Java Program to Reverse a String

This Java program defines a class called ReverseString that reverses a given string. It initializes a string 'name', calculates its length, and uses a for loop to build the reversed string. Finally, it prints the reversed string to the console.

Uploaded by

sumeet
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

package javaPrograms;

public class ReverseString {

public static void main(String[] args) {

String name = "DSS class";


int leng = [Link]();
String rev="";
for(int i=leng-1;i>=0;i--) {
rev=rev+[Link](i);
}
[Link]("Reverse of string is::"+rev);
}

You might also like