case1. 숫자로 변경할시 숫자형이 아닌 문자열일 경우
String codeB = "123o"; // 문자형 변수 codeB 에 문자 123O을 입력 123 + O(알파벳 대문자 O)
System.out.println(Integer.parseInt(codeB)) // 정수아닌 문자가 포함되어 에러발생
case2. 변경하는 자료형보다 범위가 큰경우
String codeC = "123123123123123123123123";
System.out.println(Integer.parseInt(codeC)) // int 범위보다 큰 정수여서 에러발생
case3. null 입력시
String codeD = null;
System.out.println(Integer.parseInt(codeD)) // null을 변환시키려고 해서 에러발생
case4. 문자 앞뒤로 공백이 있는경우
String codeE = " 123 ";
System.out.println(Integer.parseInt(codeE)) // 123 문자열 앞뒤에 공백이 있어서 에러발생
'오류' 카테고리의 다른 글
ORA-28040: 일치하는 인증 프로토콜 없음, No matching authentication protocol (0) | 2022.12.18 |
---|---|
mysql_Data too long for column (0) | 2022.12.12 |
gitbash_git rm 'file' (0) | 2022.12.12 |
Every derived table must have its own alias (0) | 2022.12.10 |
The import javax.servlet.jsp cannot be resolved (0) | 2022.12.10 |