單項(xiàng)選擇題

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.

題目列表

你可能感興趣的試題

微信掃碼免費(fèi)搜題