reverse function of string in java code example
Example 1: java string reverse
String rev = new StringBuilder("Your String").reverse().toString();
Example 2: Reverse a string in java
// reverse a string using character array
class ReverseUsingCharacterArray
{
public static void main(String[] args)
{
String str = "HelloWorldJava";
char[] ch = str.toCharArray();
for(int a = ch.length - 1; a >= 0; a--)
System.out.print(ch[a]);
}
}