r, t, t,
r, e, o,
Compilation fails.
An exception is thrown at runtime.
第1题:
Point p = Line.getPoint();
Line.Point p = Line.getPoint();
Point p = (new Line()).getPoint();
Line.Point p = (new Line()).getPoint();
第2题:
Compilation will fail.
The program prints “0”.
The program prints “3”.
Compilation will succeed but an exception will be thrown at line 3.
第3题:
At most one listener of each type can be registered with a component.
Mouse motion listeners can be registered on a List instance.
There exists a class named ContainerEvent in package java.awt.event.
There exists a class named MouseMotionEvent in package java.awt.event.
There exists a class named ActionAdapter in package java.awt.event.
第4题:
Compilation succeeds and 1 is printed.
Compilation succeeds and 2 is printed.
An error at line 8 causes compilation to fail.
An error at line 14 causes compilation to fail.
Compilation succeeds but an exception is thrown at line 14.
第5题:
passed stuff
stuff passed
passed An AssertionError is thrown with the word “stuff” added to the stack trace.
passed An AssertionError is thrown without the word “stuff” added to the stack trace.
passed An AssertionException is thrown with the word “stuff” added to the stack trace.
passed An AssertionException is thrown without the word “stuff” added to the stack trace.
第6题:
The output is x = 6 y = 0
The output is x = 7 y = 0
The output is x = 6 y = -1
The output is x = 7 y = -1
Compilation will fail.
第7题:
Compilation fails because of an error in line 3.
Compilation fails because of an error in line 7.
Compilation fails because of an error in line 9.
If you define D e = new E(),then e.bMethod() invokes the version of bMethod() defined in Line 5.
If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.
If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 9.
第8题:
0
1
14
–15
An error at line 3 causes compilation to fail.
An error at line 4 causes compilation to fail.
第9题:
est
es
str
st
s
第10题:
AnAdapter1 aa=new AnAdapter1(){}
AnAdapter0 aa=new AnAdapter0(){}
AnAdapter0 aa=new AnAdapter0(5){}
AnAdapter1 aa=new AnAdapter1(5){}
AnInterface a1=new AnInterface(5){}
第11题:
/test/Chess.class
/home/bob/Chess.class
/test/games/Chess.class
/usr/lib/games/Chess.class
/home/bob/games/Chess.class
inside jarfile /opt/java/lib/Games.jar (with a correct manifest)
inside jarfile /home/bob/downloads/Games.jar (with a correct manifest)
第12题:
Int
Byte
Long
Short
Float
Double
第13题:
restore 400
restore 403
restore 453
Compilation fails.
An exception is thrown at runtime.
第14题:
Jar A
Jar B
Jar C
Jar D
Jar E
第15题:
It can be any class.
No class has access to base.
The class must belong to the geometry package.
The class must be a subclass of the class Hypotenuse.
第16题:
All the buttons change height if the frame height is resized.
All the buttons change width if the Frame width is resized.
The size of the button labeled “One” is constant even if the Frame is resized.
Both width and height of the button labeled “Three” might change if the Frame is resized.
第17题:
int
byte
long
short
float
double
第18题:
An anonymous class can be declared as static.
A static inner class cannot be a static member of the outer class.
A static inner class does not require an instance of the enclosing class.
Instance members of a static inner class can be referenced using the class name of the static inner class.
第19题:
Compilation fails.
hello from a
hello from b
hello from b hello from a
hello from a hello from b
第20题:
int addValue( int a, int b ){// do something...}
public void addValue (){// do something...}
public int addValue( int a ){// do something...}
public int addValue( int a, int b )throws MyException {//do something...}
第21题:
return super.hashCode();
return name.hashCode() + age * 7;
return name.hashCode() + comment.hashCode() /2;
return name.hashCode() + comment.hashCode() / 2 - age * 3;
第22题:
000000000
0123456789
Compilation fails.
The code runs with no output.
The code enters an infinite loop.
An exception is thrown at runtime.
第23题:
Compilation succeeds.
Compilation fails because of an error at line 5.
Compilation fails because of an error at line 6.
Compilation fails because of an error at line 14.
Compilation fails because of an error at line 17.
第24题:
i = 6 and j= 5
i = 5 and j= 5
i = 6 and j= 4
i = 5 and j= 6
i = 6 and j= 6