Convert a String to an int in Java

How to convert a String to an int in java? The Java Integer wrapper class provides a method parseInt to convert a String to an int.  Here is the method signature: One thing that you will note in the declaration is that the method also throws NumberFormatException.  Just note it for now, we will see below why this exception is … [Read more…]