어쩌면 모두 궁금할지도?
intValue() vs. Integer.parseInt()
notcherry
2023. 7. 12. 19:34
728x90
반응형
intValue()
래퍼 클래스 'Integer' 객체를 기본 데이터 타입 'int'로 변환하는 메소드
Integer num = 1;
int convertedNum = num.intValue();
Integer 객체 값을 int로 변환하여 convertedNum변수에 저장했다.
Integer.parseInt()
문자열을 해당 기본 데이터 타입 'int'로 변환하는 메소드.
String str = 1;
int num = Integer.parseInt(str);
728x90
반응형