多项选择题

class One { 
 public One foo() { return this; } 
} 
class Two extends One { 
public One foo() { return this; } 
} 
class Three extends Two { 
 // insert method here 
} 
Which two methods, inserted individually, correctly complete the Three class?()

A. public void foo() { }
B. public int foo() { return 3; }
C. public Two foo() { return this; }
D. public One foo() { return this; }
E. public Object foo() { return this; }


您可能感兴趣的试卷

你可能感兴趣的试题

1.多项选择题

A JavaBeans component has the following field: 
11. private boolean enabled; 
Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()

A. public void setEnabled( boolean enabled) public boolean getEnabled()
B. public void setEnabled( boolean enabled) public void isEnabled()
C. public void setEnabled( boolean enabled) public boolean isEnabled()
D. public boolean setEnabled( boolean enabled) public boolean getEnabled()

5.多项选择题

10. class Foo { 
11. static void alpha() { /* more code here */ } 
12. void beta() { /* more code here */ } 
13. } 
Which two are true?()

A. Foo.beta() is a valid invocation of beta().
B. Foo.alpha() is a valid invocation of alpha().
C. Method beta() can directly call method alpha().
D. Method alpha() can directly call method beta().

6.单项选择题

11. public static void main(String[] args) { 
12. Object obj =new int[] { 1,2,3 }; 
13. int[] someArray = (int[])obj; 
14. for (int i: someArray) System.out.print(i +“ “) 
15. } 
What is the result? ()

A. 1 2 3
B. Compilation fails because of an error in line 12.
C. Compilation fails because of an error in line 13.
D. Compilation fails because of an error in line 14.
E. A ClassCastException is thrown at runtime.

8.单项选择题

public class Ball { 
public enum Color { RED, GREEN, BLUE }; 
public void foo() { 
// insert code here 
{ System.out.println(c); } 
} 
} 
Which code inserted at line 14 causes the foo method to print RED, GREEN, and BLUE?() 

A. for( Color c : Color.values())
B. for( Color c = RED; c <= BLUE; c++)
C. for( Color c; c.hasNext() ; c.next())
D. for( Color c = Color[0]; c <= Color[2]; c++)
E. for( Color c = Color.RED; c <= Color.BLUE; c++)

9.多项选择题Which two code fragments correctly create and initialize a static array of int elements?() 

A. static final int[] a = { 100,200 };
B. static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }
C. static final int[] a = new int[2] { 100,200 };
D. static final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }

10.多项选择题

35. String #name = “Jane Doe”; 
36. int$age=24; 
37. Double_height = 123.5; 
38. double~temp = 37.5; 
Which two are true?()

A. Line 35 will not compile.
B. Line 36 will not compile.
C. Line 37 will not compile.
D. Line 38 will not compile.

最新试题

What is the result?()

题型:单项选择题

A programmer must create a generic class MinMax and the type parameter of MinMax must implement Comparable. Which implementation of MinMax will compile?()

题型:单项选择题

Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()

题型:多项选择题

Given:  foo and bar are public references available to many other threads, foo refers to a Thread and bar is an Object. The thread foo is currently executing bar.wait().  From another thread, what provides the most reliable way to ensure that foo will stop executing wait()?()

题型:单项选择题

Given that Triangle implements Runnable, and:Which two statements, inserted independently at both lines 35 and 41, tend to allow both threads to temporarily pause and allow the other thread to execute?()

题型:多项选择题

What is the result?()

题型:单项选择题

What is the result?()

题型:单项选择题

What is the result?()

题型:单项选择题

Which statement is true about the set variable on line 12?()

题型:单项选择题

What is the result?()

题型:单项选择题