QUESTION 41자격증/OCJP_ExamB2018. 7. 11. 14:19
Table of Contents
반응형
QUESTION 41
Given:
public class Test {
public enum Dogs {collie, harrier};
public static void main(String [] args) {
Dogs myDog = Dogs.collie;
switch (myDog) {
case collie:
System.out.print("collie ");
case harrier:
System.out.print("harrier ");
}
}
}
What is the result?
A. collie
B. harrier
C. Compilation fails.
D. collie harrier
E. An exception is thrown at runtime.
Solution : D
plus imformation
switch 문에 break 가 없기 때문에 실패로 끝날 것이다.
반응형
'자격증 > OCJP_ExamB' 카테고리의 다른 글
QUESTION 43 (0) | 2018.07.13 |
---|---|
QUESTION 42 (0) | 2018.07.13 |
QUESTION 40 (0) | 2018.07.11 |
QUESTION 39 (0) | 2018.07.11 |
QUESTION 38 (0) | 2018.07.11 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상