Answers for "reverse a string in java using input"

13

how to reverse a string in java

public class ReverseString {
    public static void main(String[] args) {
        String s1 = "neelendra";
        for(int i=s1.length()-1;i>=0;i--)
            {
                System.out.print(s1.charAt(i));
            }
    }
}
Posted by: Guest on March-14-2020
5

java string reverse

String rev = new StringBuilder("Your String").reverse().toString();
Posted by: Guest on December-28-2020
0

reverse a string in java using input

public class Main {

    public static void main(String[] args) {
	// Write a Java program to reverse a string.
        Scanner input = new Scanner(System.in);
        System.out.println("Enter the String:");
        char[] letters = input.nextLine().toCharArray();
        System.out.println(" Reverse String");
        for(int i = letters.length -1; i >= 0; i--){
            System.out.print(letters[i]);
        }
    }
}
Posted by: Guest on January-05-2021
4

reverse a string in java

As we know that String is immutable. String class do not have reverse() method.
Posted by: Guest on October-23-2020

Code answers related to "reverse a string in java using input"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language