Line l = new Line() ; l.Point p = new l.Point();
Line.Point p = new Line.Point();
The Point class cannot be instatiated at line 15.
Point p = new Point();
第1题:
A.Point p = Line.getPoint();
B.Line.Point p = Line.getPoint();
C.Point p = (new Line()).getPoint();
D.Line.Point p = (new Line()).getPoint();
第2题:
class Super { public int getLenght( ) { return 4; } } public class Sub extends Super { public long getLenght( ) { return 5; } public static void main(String[] args) { Super sooper = new Super( ); Sub sub = new Sub( ); System.out.println( sooper.getLenght( ) + “,” + sub.getLenght( ) ); } } What is the output?()
第3题:
Given the following code fragment: public void create() { Vector myVect; myVect = new Vector(); } Which of the following statements are true?()
第4题:
Given the following code, write a line of code that, when inserted at the indicated location, will make the overriding method in Extension invoke the overridden method in class Base on the current object. class Base { public void print( ) { System.out.println("base"); } } class Extention extends Base { public void print( ) { System.out.println("extension"); // insert line of implementation here } } public class Q294d { public static void main(String args[]) { Extention ext = new Extention( ); ext.print( ); } } Fill in a single line of implementation.()
第5题:
10. class Line { 11. public class Point { public int x,y; } 12. public Point getPoint() { return new Point(); } 13. } 14. class Triangle { 15. public Triangle() { 16. // insert code here 17. } 18. } Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()
第6题:
new Inner(); // At line 3
new Inner(); // At line 8
new o.Inner(); // At line 8
new Outer.Inner(); // At line 8
第7题:
Compilation of class A fails.
Line 28 prints the value 3 to System.out.
Line 28 prints the value 1 to System.out.
A runtime error occurs when line 25 executes.
Compilation fails because of an error on line 28.
第8题:
Line l = new Line() ; l.Point p = new l.Point();
Line.Point p = new Line.Point();
The Point class cannot be instatiated at line 15.
Point p = new Point();
第9题:
The declaration on line 2 does not allocate memory space for the variable myVect.
The declaration on line 2 allocates memory space for a reference to a Vector object.
The statement on line 2 creates an object of class Vector.
The statement on line 3 creates an object of class Vector.
The statement on line 3 allocates memory space for an object of class Vector.
第10题:
Point p = Line.getPoint();
Line.Point p = Line.getPoint();
Point p = (new Line()).getPoint();
Line.Point p = (new Line()).getPoint();
第11题:
Point p = new Point();
Line.Point p = new Line.Point();
The Point class cannot be instatiated at line 15.
Line 1 = new Line() ; 1.Point p = new 1.Point();
第12题:
Just after line 13.
Just after line 14.
Just after line 15.
Just after line 16 (that is, as the method returns).
第13题:
1. public class Outer{ 2. public void someOuterMethod() { 3. // Line 3 4. } 5. public class Inner{} 6. public static void main( String[]argv ) { 7. Outer o = new Outer(); 8. // Line 8 9. } 10. } Which instantiates an instance of Inner?()
第14题:
10. class Line { 11. public static class Point { } 12. } 13. 14. class Triangle { 15. // insert code here 16. } Which code, inserted at line 15, creates an instance of the Point class defined in Line?()
第15题:
Given the following code: 1) class Parent { 2) private String name; 3) public Parent(){} 4) } 5) public class Child extends Parent { 6) private String department; 7) public Child() {} 8) public String getValue(){ return name; } 9) public static void main(String arg[]) { 10) Parent p = new Parent(); 11) } 12) } Which line will cause error?()
第16题:
1. class Bar { } 1. class Test { 2. Bar doBar() { 3. Bar b = new Bar(); 4. return b; 5. } 6. public static void main (String args[]) { 7. Test t = new Test(); 8. Bar newBar = t.doBar(); 9. System.out.println(“newBar”); 10. newBar = new Bar(); 11. System.out.println(“finishing”); 12. } 13. } At what point is the Bar object, created on line 3, eligible for garbage collection?()
第17题:
Given: 11. public void genNumbers() { 12. ArrayList numbers = new ArrayList(); 13. for (int i=0; i<10; i++) { 14. int value = i * ((int) Math.random()); 15. Integer intObj = new Integer(value); 16. numbers.add(intObj); 17. } 18. System.out.println(numbers); 19. } Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?()
第18题:
Line 16
Line 17
Line 18
Line 19
第19题:
line 3
line 6
line 7
line 8
line 10
第20题:
Compilation of class A fails.
Line 28 prints the value 3 to System.out.
Line 28 prints the value 1 to System.out.
Compilation fails because of an error on line 28.
A runtime error occurs when line 25 executes.
第21题:
Line 19
The object is NOT a candidate for garbage collection.
Line 17
Line 16
Line 18
第22题:
After line 8.
After line 10.
After line 4, when doBar() completes.
After line 11, when main() completes.
第23题:
The application will crash.
The code on line 29 will be executed.
The code on line 5 of class A will execute.
The code on line 5 of class B will execute.
The exception will be propagated back to line 27.
第24题:
Line 16
Line 17
Line 18
Line 19
The object is NOT a candidate for garbage collection.