Cómo obtener INT de String Java
// You will receive an error if there are non-numeric characters in the String.
String num = "5";
int i = Integer.parseInt(num);
Zany Zebra
// You will receive an error if there are non-numeric characters in the String.
String num = "5";
int i = Integer.parseInt(num);
String year = "2022";
int a = Integer.parseInt(year);
String str = "ab";
char[] ch = str.toCharArray();
System.out.println("position 0 = " + (int)ch[0]);