多项选择题

Given:

What are four valid examples of polymorphic method calls?()

A.x.a2();
B.z.a2();
C.z.c1();
D.z.a1();
E.y.c1();
F.x.a1();


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

Given:

What is the result?()

A.peep
B.bark
C.meow
D.Compilation fails.
E.An exception is thrown at runtime.

2.单项选择题

Given:

Which change can you make to Target without affecting Client?()

A.Line 4 of class Target can be changed to return i++;
B.Line 2 of class Target can be changed to private int i = 1;
C.Line 3 of class Target can be changed to private int addOne(){
D.Line 2 of class Target can be changed to private Integer i = 0;

3.单项选择题

Given a method that must ensure that its parameter is not null:
11. public void someMethod(Object value) {
12. // check for null value
...
20. System.out.println(value.getClass());
21. }
What inserted at line 12, is the appropriate way to handle a null value?()

A.assert value == null;
B.assert value != null, "value is null";
C.if (value == null) { throw new AssertionException("value is null"); }
D.if (value == null) { throw new IllegalArgumentException("value is null"); }

5.单项选择题

Given:
11.double input = 314159.26;
12.NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN);
13.String b;
14.//insert code here
Which code, inserted at line 14, sets the value of b to 314.159,26?()

A.b = nf.parse( input );
B.b = nf.format( input );
C.b = nf.equals( input );
D.b = nf.parseObject( input );

9.多项选择题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()

A.When using versions of Java technology earlier than 5.0.
B.When sharing a StringBuffer among multiple threads.
C.When using the java.io class StringBufferInputStream.
D.When you plan to reuse the StringBuffer to build more than one string.