Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
|
| Review Questions |
| 1.1 | Which statement about methods is true?
Select the one correct answer.
|
| 1.2 | Which statement about objects is true?
Select the one correct answer.
|
| 1.3 | Which is the first line of a constructor declaration in the following code?
public class Counter { // (1)
int current, step;
public Counter(int startValue, int stepValue) { // (2)
setCurrent(startValue);
setStep(stepValue);
}
public int getCurrent() { return current; } // (3)
public void setCurrent(int value) { current = value; } // (4)
public void setStep(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 about instance members is true?
Select the one correct answer.
|
| 1.6 | How do objects communicate 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.
|