Actually, @GoToLoop answer is both correct and better. int(someString)
gets turned into parseInt(someString)
. I would use the latter personally, as you’ll get less confused by normal Java code later. parseInt
calls Integer.parseInt
which is what you want here. Integer.valueOf
returns an Integer not an int.
3 Likes