Home  |   STIU  |   WOW  |   SCJP  |   SCDJWS   |   JEE FAQ  |   About US  |  

FAQ
  Java FAQ
  JSP FAQ
  Servlet FAQ
 

Advertisement

XyzWs Java FAQ:
Is a class subclass of itself?


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
Advertisement
Is a class subclass of itself?

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.

 


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

Support  | Feedback  | Help