Quote:
Originally posted by scoobydugan
the only thing is i am gettin one error on the s=s.reverse(); Do i have to import something before the class to make this reverse work?
|
Ah! I saw that you used that method in your original source, and incorrectly assumed it was an actual method of class String.
Withoud this method, you have to manually print out the reversed string. This should do the trick:
Code:
//Prints out the string s backwards
public static void backward (String s)
{//start backward
System.out.println("String reversed is: ");
for(int i=s.length()-1; i>=0; i--){
System.out.print(s.charAt(i));
}
System.out.println();
}//end backward