单项选择题

Given:

Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()

A.Point p = Line.getPoint();
B.Line.Point p = Line.getPoint();
C.Point p = (new Line()).getPoint();
D.Line.Point p = (new Line()).getPoint();


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题

Given:

What is the result?()

A.Compilation succeeds.
B.Exactly one class does NOT compile.
C.Exactly two classes do NOT compile.
D.Exactly four classes do NOT compile.
E.Exactly three classes do NOT compile.

2.多项选择题

Given:

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

3.单项选择题

Given:

What is the result?()

A.3
B.23
C.32
D.123
E.321

4.单项选择题

Given:

What is the result?()

A.2
B.3
C.4
D.6
E.7

6.单项选择题

Click the Exhibit button.

What is the result?()

A.Compilation of class A fails.
B.Line 28 prints the value 3 to System.out.
C.Line 28 prints the value 1 to System.out.
D.A runtime error occurs when line 25 executes.
E.Compilation fails because of an error on line 28.

7.单项选择题

Given:

Which statement is true about the class of an object that can reference the variable base?()

A.It can be any class.
B.No class has access to base.
C.The class must belong to the geometry package.
D.The class must be a subclass of the class Hypotenuse.

8.单项选择题

Given:

What is the result?()

A.Hello
B.Hello World
C.Compilation fails.
D.Hello World 5
E.The code runs with no output.

9.多项选择题Which four statements are true?()

A.Has-a relationships should never be encapsulated.
B.Has-a relationships should be implemented using inheritance.
C.Has-a relationships can be implemented using instance variables.
D.Is-a relationships can be implemented using the extends keyword.
E.Is-a relationships can be implemented using the implements keyword.
F.An array or a collection can be used to implement a one-to-many has-a relationship.

10.多项选择题

Given:

Which four code fragments, inserted independently at line 7, will compile?()

A.public void m1() { }
B.protected void m1() { }
C.private void m1() { }
D.void m2() { }
E.public void m2() { }
F.protected void m2() { }