This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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)