public class ConvertStringToNumber {
public static void main(String[] args) {
// create new string
String value = "10000";
// convert to integer
int valueInt = Integer.valueOf(value).intValue();
// convert to long
long valueLong = Long.valueOf(value).longValue();
// convert to float
float valueFloat = Float.valueOf(value).floatValue();
// convert to double
double valueDouble = Double.valueOf(value).doubleValue();
}
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment