I have \"Hello World\" kept in a String variable named hi.
\"Hello World\"
hi
I need to print it, but reversed.
How can I do this? I understand there
It gets the value you typed and returns it reversed ;)
public static String reverse (String a){ char[] rarray = a.toCharArray(); String finalvalue = ""; for (int i = 0; i < rarray.length; i++) { finalvalue += rarray[rarray.length - 1 - i]; } return finalvalue;
}