How do you convert a string to an Int

Question:
How does one convert a String to an int in Java?

Answer:
Use the method Integer.parseInt()

Code:
public class StringToInt {
   public static void main(String[] args) {
 
      String str1 = "111";
      String str2 = "333";
 
      int x1 = Integer.parseInt(str1);
      int x2 = Integer.parseInt(str2);
 
      int x3 = x1 + x2;
 
      System.out.println("x3 = " + x3);
 
   }
}

Output:
$ java StringToInt 
x3 = 444