将String转换为Integer(Java)时出现NumberFormatException

时间:2019-05-07 16:07:35

标签: java netbeans-8

我需要将String转换为整数,但我一直在获取NumberFormatException。我该如何解决?

  String a="3516818180";
  int b=0;
  b=Integer.parseInt(a);
  System.out.println("result"+b);

Exception in thread "main" java.lang.NumberFormatException: For input string: "3516818180"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:583)
    at java.lang.Integer.parseInt(Integer.java:615)
    at pruebaprueba.Pruebaprueba.main(Pruebaprueba.java:45)

0 个答案:

没有答案