Sunday, March 18, 2018

Write a Java Program to reverse an String without reverse() method



// Write a Java Program to reverse a string without reverse() method


import java.util.*;
class ReverseString
{
public static void main(String[] args)
{
String s="Vishnu";
StringBuffer sb=new StringBuffer("");
for(int i=s.length()-1;i>=0;i--)
sb.append(s.charAt(i));
System.out.println(sb);
}
}




Write a Java Program to reverse an String without reverse() method



Share this

0 Comment to "Write a Java Program to reverse an String without reverse() method"

Post a Comment