Home Segments Top Top Previous Next

916: Mainline

Often, you want the value of an integer that a string represents, so you have to convert the string into an integer using the parseInt class method found in the Integer class. Thus, the following produces an integer from a text-field's string:

Integer.parseInt(field1.getText());