Java Reference
In-Depth Information
4.
The Whale class compiles fine, but the Cat class does not. Why not? What can be done
to fix the problem?
5.
Is the following statement valid?
Mammal m = new Whale();
6.
What is the output of the following statements?
Whale w = new Whale();
w.breathe();
w.nurse();
Mammal m = w;
m.breathe();
m.nurse();
7.
Using the statements in the previous question, is the expression m instanceof Whale
true or false?
8.
Similarly, is the expression w instanceof Mammal true or false?
9.
What about the expression m instanceof Cat ?
Search WWH ::




Custom Search