xxxxxxxxxx
int result = Integer.parseInt("500");
System.out.println(result) // prints 500 as int
xxxxxxxxxx
String number = "10";
int result = Integer.parseInt(number);
System.out.println(result);
Copy
xxxxxxxxxx
class Scratch{
public static void main(String[] args){
String str = "50";
System.out.println( Integer.parseInt( str )); // Integer.parseInt()
}
}
xxxxxxxxxx
class scratch{
public static void main(String[] args) {
String str = "54";
int num = Integer.parseInt("54");
double doub = Double.parseDouble("54");
}
}
xxxxxxxxxx
String myString = "1234";
int foo = Integer.parseInt(myString);