What is the result?

Given:
1. public class Test {
2. public enum Dogs {collie, harrier, shepherd};
3. public static void main(String [] args) {
4. Dogs myDog = Dogs.shepherd;
5. switch (myDog) {
6. case collie:
7. System.out.print("collie ");
8. case default:
9. System.out.print("retriever ");
10. case harrier:
11. System.out.print("harrier ");
12. }
13. }
14.}
What is the result?
A. harrier
B. shepherd
C. retriever
D. Compilation fails.
E. retriever harrier
F. An exception is thrown at runtime.

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.