래퍼 클래스 - 주요 메서드와 성능


<aside> 🌜

설명


package string.wrapper;

public class WrapperUtilsMain {

    public static void main(String[] args) {
        Integer i1 = Integer.valueOf(10);
        Integer i2 = Integer.valueOf("10");
        int intValue = Integer.parseInt("10");
        
        int compareResult = i1.compareTo(20);
        System.out.println("compareResult = " + compareResult);
        
        System.out.println(Integer.sum(10,20));
        System.out.println(Integer.max(10,20));
        System.out.println(Integer.min(10,20));
    }
}

출력
compareResult = -1
30
20
10

기본형 vs 래퍼 클래스


<aside> 👒

설명


image.png

image.png

</aside>