Write a Java program to convert a string to an integer

Source Code:

public class P18 {
public static void main(String[] args) {
String s = “123”;
int n = Integer.parseInt(s);
System.out.println(n);
}
}

Output: