Java Reference
In-Depth Information
ȗ DepartmentChair
ȗ Janitor
ȗ SeminarSpeaker
ȗ Person
ȗ Course
ȗ Seminar
ȗ Lecture
ȗ ComputerLab
΢΢΢Exercise R10.9. Which of these conditions returns true ? Check the
Java documentation for the inheritance patterns.
a. Rectangle r = new Rectangle(5, 10, 20, 30) ;
b. if (r instanceof Rectangle) È
c. if (r instanceof Point) È
d. if (r instanceof Rectangle2D.Double) È
e. if (r instanceof RectangularShape) È
f. if (r instanceof Object) È
g. if (r instanceof Shape) È
΢΢Exercise R10.10. Explain the two meanings of the super keyword.
Explain the two meanings of the this keyword. How are they related?
΢΢΢Exercise R10.11. (Tricky.) Consider the two calls
public class D extends B
{
public void f()
{
this.g(); // 1
Search WWH ::




Custom Search