String nombre_str = "22";Runtime:
int 숫자 = Integer.parseInt(nombre_str);
System.out.println(숫자);
22
String nombre_s="22";Execution
int 숫자 = Integer.valueOf(nombre_s);
System.out.println(숫자);
22
String nombre_s="9Ab";
int 숫자 = Integer.parseInt(nombre_s);
System.out.println(숫자);
< / pre> 출력 :스레드 "main"의 예외 java.lang.NumberFormatException : 입력 문자열의 경우 : "9Ab"
java.lang.NumberFormatException.forInputString (알 수없는 소스)
java.lang.Integer.parseInt (알 수없는 소스)
java.lang.Integer.valueOf (알 수없는 소스)
< / pre>
리소스 :
http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#valueOf(java.lang.String, int)
http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#parseInt(java.lang.String) ᅡ>
Please disable your ad blocker and refresh the window to use this website.