定義枚舉如下: public enum Direction{ EAST,SOUTH,WEST,NORTH } 下列正確使用該枚舉類型的語句是哪項?()
A.Direction Direction=EAST; B.Direction direction=Direction.WEST; C.int a- Direction.NORTH; D.Direction direction=2;
現(xiàn)有: class TestFoo f int x; String y; int getX() { return x; } String getY() {return y; } void setX (int x) { int Z=7: this.x=x; } 可以添加多少個修飾符來封裝此類?()
A.5 B.4 C.3 D.2
現(xiàn)有: class Banana2 f static int X=2; public static void main (String [] args) { int X=2; Banana2 b=new Banana2(); b.go(x); } static {x+=x; } void go (int x) { ++x; System. out.println (x); } 結(jié)果為:()
A.7 B.5 C.3 D.2