Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

Program Discussion :: Strings

Home > Programs > Strings

44 / 59

Write program to reverse of string without using any loop.


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:


Post Your Reply Here: