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? ()
第1题:
10. abstract public class Employee { 11. protected abstract double getSalesAmount(); 12. public double getCommision() { 13. return getSalesAmount() * 0.15; 14. } 15. } 16. class Sales extends Employee { 17. // insert method here 18. } Which two methods, inserted independently at line 17, correctly complete the Sales class?()
第2题:
11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12?()
第3题:
A
B
C
D
E
F
第4题:
Foo { public int bar() { return 1; } }
new Foo { public int bar() { return 1; } }
newFoo() { public int bar(){return 1; } }
new class Foo { public int bar() { return 1; } }
第5题:
public void setEnabled( boolean enabled) public boolean getEnabled()
public void setEnabled( boolean enabled) public void isEnabled()
public void setEnabled( boolean enabled) public boolean isEnabled()
public boolean setEnabled( boolean enabled) public boolean getEnabled()
第6题:
Compilation fails because of an error in line 3.
Compilation fails because of an error in line 7.
Compilation fails because of an error in line 9.
If you define D e = new E(), then e.bMethod() invokes the version of bMethod()defined in Line 5.
If you define D e = (D)(new E()),then e.bMethod() invokes the version of bMethod() defined in Line 5.
If you define D e = (D)(new E()), then e.bMethod() invokes the version of bMethod() defined in Line 9.
第7题:
0
3
4
5
The code will not compile.
第8题:
Compilation fails.
ClassC is displayed.
The code runs with no output.
An exception is thrown at runtime.
第9题:
Line 13
Line 14
Line 18
Line 20
第10题:
Compilation fails.
Cannot add Toppings
The code runs with no output.
A NullPointerException is thrown in Line 4.
第11题:
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?()
第12题:
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?()
第13题:
peep
bark
meow
Compilation fails.
An exception is thrown at runtime.
第14题:
Value is: 8
Compilation fails.
Value is: 12
Value is: -12
The code runs with no output.
An exception is thrown at runtime.
第15题:
Point p = Line.getPoint();
Line.Point p = Line.getPoint();
Point p = (new Line()).getPoint();
Line.Point p = (new Line()).getPoint();
第16题:
StackOverflowError
NullPointerException
NumberFormatException
IllegalArgumentException
ExceptionlnlnitializerError
第17题:
Change line 2 to: public int a;
Change line 2 to: protected int a;
Change line 13 to: public Sub() { this(5); }
Change line 13 to: public Sub() { super(5); }
Change line 13 to: public Sub() { super(a); }
第18题:
Direction d = NORTH;
Nav.Direction d = NORTH;
Direction d = Direction.NORTH;
Nav.Direction d = Nav.Direction.NORTH;
第19题:
The function method must have the signature: public String spin().
The method must be mapped to the logical name spin in the web.xml file.
The function method must have the signature: public String spinIt().
The function method must have the signature public static String spin().
The function method must have the signature: public static String spinIt().
The function class must be named Spinner, and must be in the package com.example.
第20题:
final
static
native
public
private
abstract
protected