SCJP題庫第093題

10. class Nav{
11.   public enum Direction { NORTH, SOUTH, EAST, WEST }
12.   }
13.   public class Sprite{
14.     //insert code here
15.   }
Which code, inserted at line 14, allows the Sprite class to compile?


A. Direction d = NORTH;
B. Nav.Direction d = NORTH;
C. Direction d = Direction.NORTH;
D. Nav.Direction d = Nav.Direction.NORTH;
 
Ans: D
 
解說:
列舉型態可視為類別的內部靜態類別,使用時以使用靜態成員的方式。

Comments

Popular posts from this blog

Android+Google Map API v3 Geocoding(地址轉經緯度度