새싹반
Integer a = Integer.valueOf(1);
Wrapper class로 선언한 정수형 a
public final class Integer
Integer는 class이다.
=> final이 붙으면 상속이 불가능하다
=> Integer는 final class 이므로 상속이 불가능하다
=> String도 불변 객체이다
=> 따라서, 수정이 안되므로 새로운 객체를 만들어서 반환한다
객체로 만든 a, b
Integer a = Integer.valueOf(128);
Integer b = Integer.valueOf(128);
System.out.prinln(a == b) // false
각자 다른 객체가 다른 위치에 저장된 128을 가리키므로 다르다.
a.compareTo(b); // 1
a.equals(b) // true
A.compareTo(B): A와 B의 값이 같으면 1 아니면 0을 반환
A.equals(B): A와 B의 값이 같으면 true 아니면 false를 반환
String string = a.toString();
Integer 객체인 a를 String으로 바꿔준다.
Integer.valueOf(변수) // 변수의 값을 반환
int max = Integer.max(1, 2); // 2 반환
int min = Integer.min(1, 2); // 1 반환
int maxValue = Integer.MAX_VALUE
int minValue = Integer.MIN_VALUE
Integer의 최대값 최소값을 반환
MAX_VALUE: 21억
MIN_VALUE: -21억
startTime = System.currentTimeMillis();
endTime = System.currentTimeMillis();
기본형