Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 소비통장
- git pull
- window11 Education
- 정처기
- 윈도우10 Education
- Spring Boot
- 방송대
- git
- json string
- window10 Education
- java
- git pull --rebase
- git 설정
- github
- 취업
- 아임포트
- window11
- IAMPORT
- 방통대
- vmware workstation player
- ObjectMapper
- 취성패
- 런던뮤지컬
- 자바
- window10
- 오블완
- 티스토리챌린지
- snake case
- 운영체제
- camel case
Archives
- Today
- Total
솔솔 개발블로그
[JAVA] switch case문에서 enum class 사용 오류 본문
반응형
1. 오류 내용
An enum switch case label must be the unqualified name of an enumeration constant

switch case문 작성 시 발생하는 오류이다.
2. 해결
switch case문에서 enum을 사용하려면, class명.enum값이 아닌 enum값만 적으면 된다.

3. 오류원인
관련 내용을 찾아보니 이런 답변을 찾았다. 링크
As per Java docs The Identifier in a EnumConstant may be used in a name to refer to the enum constant.
자바 문서에 따르면, enum상수의 식별자에서 이름(name)은 enum 상수를 참조하는데 사용될 수 있다.
정도로 해석하면 될 것 같다.
반응형
'프로그래밍 > 오류 정리' 카테고리의 다른 글
| [springdoc open-api] swagger Failed to fetch 오류 (1) | 2022.06.14 |
|---|
Comments