-Method to convert to integer Integer.parseInt (variable name);
-Method to convert to decimal Double.parseDouble (variable name);
String text = "123"
System.out.println(text); // 123 (Output as it is as a character string)
System.out.println(Integer.parseInt(text)); // 123 (Convert to integer)
System.out.println(Double.parseDouble(text)); // 123.0 (Convert to decimal)
Recommended Posts