I can't remember how to convert a string to an int. I have the variable x which has the value of "1". How can I then convert it to an int? I've tried something like... int x = (int)x and int y = (int)x but I always get errors. Thanks.
There are three methods that I could think of given String x = "1" new Integer(x).intValue() Integer.valueOf(x).intValue() and probably the preferred way as described in the previous post Integer.parseInt(x)