Friday 1 September 2017

Java Convert String to Integer

Cited from the Book Java How to Program

The Integer class’s static method 'parseInt' takes a String argument representing an integer (e.g., the result of JOptionPane.showInputDialog) and returns the value as an int. Method parseInt is a static method of class Integer (from package java.lang). If the String does not contain a valid integer, the program will terminate with an error.

No comments:

Post a Comment