这是我在main方法中使用的代码:
String numbers = "12345678900";
long upc = Integer.parseInt(numbers);
System.out.println(upc);
Run Code Online (Sandbox Code Playgroud)
给我:
Exception in thread "main" java.lang.NumberFormatException: For input string: "12345678900"
at java.lang.NumberFormatException.forInputString...
at java.lang.Integer.parseInt....
at java.lang.Integer.parseInt...
at testRun.main...
Run Code Online (Sandbox Code Playgroud)
我不能使用double,它们需要存储为没有小数的值.我试图从字符串中获取数字串到一个包含数字的变量(没有小数)