자바 JDK1.7 쓰거든..
그럼 switch에서 String 쓸수있는거잖아
근데 아래가 계속 오류떠...
Cannot switch on a value of type String. Only convertible int values or enum constants are permitted
속상해 왜 안되는거야
아는 형있으신가
// 명령어 타입을 구분 (12비트 우측 쉬프트하여 최상단 4비트만 남김)
byte type = (IR>>12);
String typeString = String.format("x", type);
// 구분해낸 명령어 문자열을 통해 명령어 형식별로 결과를 출력함
switch (typeString) {
case "07":
System.out.println(" 02. 명령어 형식 = 'Register' reference operation");
System.out.println(" 03. Symbol = " + HexToString(IR));
break;
case "ff":
System.out.println(" 02. 명령어 형식 = 'I/O' operation");
System.out.println(" 03. Symbol = " + HexToString(IR));
break;
default:
System.out.println(" 02. 명령어 형식 = 'Memory' reference operation");
System.out.println(" 03. Symbol = " + mHexToString(type));
// 주소모드를 나타내는 4비트를 밀어버리고 12비트의 Address만 남김
TR = (short) ((IR<<4));
System.out.println(" 04. Address = " + Integer.toHexString(TR/16) + "H");
break;
}
저는그형이아닙니다만컴파일러스위치들을확인해보세요
사용하시는개발툴도잘둘러보시기바랍니다
이클립스 쓰고있습니다. 무엇이 문제일까요