多项选择题

Given:  
10. class One {  
11. void foo() { }  
12. }  
13. class Two extends One {  
14. //insert method here  
15. }  
Which three methods, inserted individually at line 14, will correctly complete class Two?()

A. public void foo() { /* more code here */ }
B. private void foo() { /* more code here */ }
C. protected void foo() { /* more code here */ }
D. int foo() { /* more code here */ }  
E. void foo() { /* more code here */ }


您可能感兴趣的试卷

你可能感兴趣的试题

2.单项选择题

Given:

What is the result? ()

A. A new Item object is created with the preferred value in the id attribute.
B. The attribute id in the Item object is modified to the new value.
C. Compilation fails.
D. An exception is thrown at runtime.
E. The attribute id in the Item object remains unchanged.

4.单项选择题

Given:

What is the result?()

A. An exception is thrown at runtime.
B. int Long
C. Compilation fails.
D. Short Long

5.单项选择题

Given:

What is the result?()

 


A.A
B.B
C.C
D.D
E.E

6.单项选择题

Given:  
12. System.out.format("Pi is approximately %d.", Math.PI);  
What is the result?()

A. An exception is thrown at runtime.
B. Pi is approximately 3.
C. Pi is approximately 3.141593.
D. Compilation fails.

7.多项选择题

Given:

Which five methods, inserted independently at line 5, will compile?()

A. protected int blipvert(long x) { return 0; }
B. protected long blipvert(int x) { return 0; }
C. private int blipvert(long x) { return 0; }
D. private int blipvert(int x) { return 0; }
E. public int blipvert(int x) { return 0; }
F. protected long blipvert(long x) { return 0; }
G. protected long blipvert(int x, int y) { return 0; }

8.多项选择题

Click the Exhibit button. 
 Given:

Which two statements are true if a NullPointerException is thrown on line 3 of class C?()

A. The application will crash.
B. The code on line 29 will be executed.
C. The code on line 5 of class A will execute.
D. The exception will be propagated back to line 27.
E. The code on line 5 of class B will execute.

9.单项选择题

Given:

What is the result?()

A. If you define D e = new E(), then e.bMethod() invokes the version of bMethod() defined in Line 5.
B. If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 5.
C. Compilation fails because of an error in line 9.
D. If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.
E. Compilation fails because of an error in line 3.
F. Compilation fails because of an error in line 7.

10.单项选择题

Given:

Which statement is true?()

A. The cardID and limit variables break polymorphism.
B. The code demonstrates polymorphism.
C. The ownerName variable breaks encapsulation.
D. The setCardInformation method breaks encapsulation.
E. The class is fully encapsulated.

最新试题

Which two code fragments correctly create and initialize a static array of int elements?()

题型:多项选择题

Given:What is the result?()

题型:单项选择题

Given:  11. // insert code here  12. private N min, max;  13. public N getMin() { return min; }  14. public N getMax() { return max; }  15. public void add(N added) {  16. if (min == null  added.doubleValue() < min.doubleValue()) 17. min = added;  18. if (max == null  added.doubleValue() > max.doubleValue()) 19. max = added;  20. }  21. }  Which two, inserted at line 11, will allow the code to compile?()

题型:多项选择题

Given:What is the result?()

题型:单项选择题

Click the Exhibit button.  Given this code from Class B:  25. A a1 = new A();  26. A a2 = new A();  27. A a3 = new A();  28. System.out.println(A.getInstanceCount());  What is the result?()

题型:单项选择题

Click the Exhibit button.  Given: ClassA a = new ClassA();  a.methodA();  What is the result?()

题型:单项选择题

Given:  11. static class A {  12. void process() throws Exception { throw new Exception(); }  13. }  14. static class B extends A {  15. void process() { System.out.println("B "); }  16. }  17. public static void main(String[] args) {  18. A a = new B();  19. a.process();  20. }  What is the result? ()

题型:单项选择题

Given:What is the result? ()

题型:单项选择题

Given: Which code, inserted at line 15, creates an instance of the Point class defined in Line?()

题型:单项选择题

Click the Exhibit button.  What is the output of the program shown in the exhibit? ()

题型:单项选择题