Posted: 9/30/2010 10:54:44 AM EDT
|
My current project in Intro to Java is to have the user input an integer, have the computer spit back the integer reversed then report if it's a palindrome. I'm lost on the public static int reverse method, how do I make a method that will accept a variable and return the reverse of that variable? |
|
Quoted:
My current project in Intro to Java is to have the user input an integer, have the computer spit back the integer reversed then report if it's a palindrome. I'm lost on the public static int reverse method, how do I make a method that will accept a variable and return the reverse of that variable? Convert it to a string, reverse it, then convert it back to an int. |
|
Quoted: Quoted: My current project in Intro to Java is to have the user input an integer, have the computer spit back the integer reversed then report if it's a palindrome. I'm lost on the public static int reverse method, how do I make a method that will accept a variable and return the reverse of that variable? Convert it to a string, reverse it, then convert it back to an int. Sneaky.... trying that now. Thank you! |