Review Questions |
1.1 |
Which statement is true about a method?
Select the one correct answer.
|
1.2 |
Which statement is true about an object?
Select the one correct answer.
|
1.3 |
Which line contains a constructor in this class definition?
public class Counter { // (1) int current, step; public Counter(int startValue, int stepValue) { // (2) set(startValue); setStepValue(stepValue); } public int get() { return current; } // (3) public void set(int value) { current = value; } // (4) public void setStepValue(int stepValue) { step = stepValue; } // (5) } Select the one correct answer.
|
1.4 |
Given that Thing is a class, how many objects and how many reference variables are created by the following code?
Thing item, stuff; item = new Thing(); Thing entity = new Thing(); Select the two correct answers.
|
1.5 |
Which statement is true about an instance method?
Select the one correct answer.
|
1.6 |
How do objects pass messages in Java?
Select the one correct answer.
|
1.7 |
Given the following code, which statements are true?
class A { int value1; } class B extends A { int value2; } Select the two correct answers.
|