public static void main(String[] args) {
String str = "4";
int in = Integer.parseInt(str);
System.out.println(in);
}
}
Output:
4
|
public static void main(String[] args) {
String str = "four";
int in = Integer.parseInt(str);
System.out.println(in);
}
}
Output:
Exception in thread “main” java.lang.NumberFormatException:
|