by @saigowthamr

How to convert string to int (integer) in Java

Home » java » How to convert string to int (integer) in Java

To convert a string to integer or a number we need to use the Integer.parseInt() method in Java.

Here is an example:

String myStr = "23";
int myNum = Integer.parseInt(myStr);

System.out.println(myNum);

// output --> 23