enum1 enum class 예제-1 enum class public enum Guitar { FENDER, MARTIN, GIBSON, ANY; public String toString(){ switch(this) { case FENDER: return "Fender"; case MARTIN: return "Martin"; case GIBSON: return "Gibson"; default: return "Unspecified"; } } } @Test public void 기타_문자열_테스트() { assertEquals(Guitar.FENDER.toString(),"Fender"); assertEquals(Guitar.MARTIN.toString(),"Martin"); } 예제-2 enum public class GuitarSh.. 2007. 7. 18. 이전 1 다음