单项选择题

Given:

What is the result?()

A.Compilation fails.
B.Cannot add Toppings
C.The code runs with no output.
D.A NullPointerException is thrown in Line 4.


您可能感兴趣的试卷

你可能感兴趣的试题

2.多项选择题

Given:

Which two code fragments, inserted independently at line 13, will compile?()

A.super(name, baseSalary);
B.this.commission = commission;
C.super(); this.commission = commission;
D.this.commission = commission; super();
E.super(name, baseSalary); this.commission = commission;

3.多项选择题

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();

4.单项选择题

Given:

What is the result?()

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

5.单项选择题

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;

6.单项选择题

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"); }

8.单项选择题

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 );

最新试题

A team of programmers is involved in reviewing a proposed design for a new utility class. After some discussion, they realize that the current design allows other classes to access methods in the utility class that should be accessible only to methods within the utility class itself.What design issue has the team discovered?()

题型:单项选择题

Given:What is the result?()

题型:单项选择题

A programmer has an algorithm that requires a java.util.List that provides an efficient implementation of add(0, object), but does NOT need to support quick random access.What supports these requirements?()

题型:单项选择题

Click the Exhibit button.Which graph represents the correct directory structure for a JAR file from which those classes can be used by the compiler and JVM?()

题型:单项选择题

Given:Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?()

题型:单项选择题

Click the Exhibit buttonWhich two statements are true if a NullPointerException is thrown on line 3 of class C?()

题型:多项选择题

Given:What is the result?()

题型:单项选择题

Click the Exhibit button.What two must the programmer do to correct the compilation errors?()

题型:多项选择题

Given:Which code fragment, inserted at the end of line 12, produces the output p is 420?()

题型:单项选择题

Given:What is the result?()

题型:单项选择题