Java String to int

We can convert String to int in java using Integer.parseInt() method.

Scenario

It is generally used if we have to perform mathematical operations on the string that contains number. Whenever we get data from textfield or textarea, entered data is received as a string. If entered data is integer, we need to convert string to int. To do so, we use Integer.parseInt() method.

Signature

The parseInt() is the static method of Integer class. The signature of parseInt() method is given below:

public static int parseInt(String s)

EXAMPLE

Flash Soon



Copyright 2017 Design& Development