Convert String to int in Java

With the help of Integer.parseInt() method, you can convert String to int in Java.

Example of Java String to int conversion

Following is the example that will show conversion from String to int-

public class Example
	public static void main(String args[])
		String s = "500";
		int i = Integer.parseInt(s);
		System.out.println(s+200); // + is used as concatenation operator
		System.out.println(i+200); // + is used as addition operator