[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

Program Discussion :: Strings

Home > Programs > Strings

334 / 60

Write program to reverse of string without using any loop.

Answer:

import java.util.*;

public class Reverse
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter a string: ");
        String str=sc.nextLine();
        StringBuffer sb=new StringBuffer(str);
        System.out.println("Reverse of the string is: "+sb.reverse());
    }
}

Asked In :: Global Edge

Post Your Answer Here:

Language:

Post Your Reply Here: