reverse string java
String string="whatever";
String reverse = new StringBuffer(string).reverse().toString();
System.out.println(reverse);
reverse string java
String string="whatever";
String reverse = new StringBuffer(string).reverse().toString();
System.out.println(reverse);
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));
}
}
}
string reverse in java
String str = "Hello";
String reverse(String str){
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.reverse();
return sb.toString();
}
reverse string array java
import java.util.Arrays;
public class ReverseStringArrayInJava
{
public static void main(String[] args)
{
String[] strHierarchy = new String[]{"Junior Developer","Senior Developer","Team Lead","Project Manager","Senior Manager","CEO"};
System.out.println("Given string array: " + Arrays.toString(strHierarchy));
for(int a = 0; a < strHierarchy.length / 2; a++)
{
String strTemp = strHierarchy[a];
strHierarchy[a] = strHierarchy[strHierarchy.length - a - 1];
strHierarchy[strHierarchy.length - a - 1] = strTemp;
}
System.out.println("Reversed string array: ");
for(int a = 0; a < strHierarchy.length; a++)
{
System.out.println(strHierarchy[a]);
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us