parse int中的数字格式异常

-6 java parseint numberformatexception

public static void main(String[] args)throws IOException {
  String s ="12312a";
  int x = Integer.parseInt(s);
  System.out.println (x+2);
}
Run Code Online (Sandbox Code Playgroud)

而我所拥有的只是:

Exception in thread "main" java.lang.NumberFormatException: For input string: "12312a"

任何提示?

Rei*_*eus 5

也许你的意思

int x = Integer.parseInt("12312a", 16);
Run Code Online (Sandbox Code Playgroud)