int상수

    [Effective java] int 상수 대신 열거 타입을 사용하라

    정수 열거 패턴 정수 상수를 한 묶음 선언해서 사용하는 패턴 public static final int APPLE_FUJI = 0; public static final int APPLE_PIPPIN = 1; public static final int APPLE_GRANNY_SMITH = 2; public static final int ORANGE_NAVEL = 0; public static final int ORANGE_TEMPLE = 1; public static final int ORANGE_BLOOD = 2; 정수 열거 패턴에는 다음과 같은 문제가 있다. 1. 타입 안전을 보장할 방법이 없다. public class IntegerEnumeration { public static void makeSa..