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

40 / 59

Write a program for string reverse without using the reverse function.


import java.io.*;

public class ReverseString 
    public static void main(String[] args)throws IOException
        String str1="";
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter a String: ");
        String str=br.readLine();
        int len = str.length();
        for(int i=len-1;i>=0;i--)
            char ch=str.charAt(i);
        System.out.println("Reverse string is: "+str1);

Asked In ::

Post Your Answer Here:


Post Your Reply Here: