Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
Practice Tech Mahindra Essay Topics

Program Discussion :: Strings

Home > Programs > Strings

44 / 59

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: