How to convert a String to an int in Java



Following example is converting a String to int.

Example

Live Demo

public class Tester {
   public static void main(String[] args) {
      String intString = "1234";
      int value = new Integer(intString).intValue();
      System.out.println(value);
   }
}

Output

1234

Advertisements