FAQ

Java

JSP

Servlet


Advertisement



Is a class subclass of itself?

No. A class is not a subclass of itself.

Chapter 6: Objects and Classes in The Complete Java 2 Certification Study Guide:

In general, a class is considered to be a subclass of itself. That is, if classes A, B, and C are defined so that C extends B, and B extends A, then the subclasses of A are A, B, and C. The term strict subclass is used to describe the subclasses excluding the class itself. So the strict subclasses of A are only B and C.

This following statement makes no sense if a class is a subclass of itself. Chapter 8: Class in JLS3.0:

A class may be declared final (8.1.1.2), in which case it cannot have subclasses.


Printer-friendly version Printer-friendly version | Send this 
article to a friend Mail this to a friend

Previous Next vertical dots separating previous/next from contents/index/pdf Contents

  |   |