Warning

 

Close
Confirm Action

Are you sure you wish to do this?

Cancel Confirm
AR15.COM
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?
9/30/2010 10:56:08 AM EDT
[#1]
pffffft, so easy to do. I wont even waste my time telling you how to do it.


9/30/2010 11:01:27 AM EDT
[#2]
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.
9/30/2010 11:14:48 AM EDT
[#3]



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!