September 2005
Beginner
576 pages
13h 6m
English
| Q1: | Can a class have more than one superclass so that it inherits additional methods and behavior? |
| A1: | It is possible with some object-oriented programming languages, but not Java. One of the goals when Java was developed was to provide a simpler language than an object-oriented language such as C++, and limiting inheritance to a single superclass was one way to achieve this. You can use a special type of class called an interface to inherit behavior that isn't received from superclasses. |
| Q2: | Most Java programs created up to this point have not used extends to inherit from a superclass. Does this mean they exist outside of the class hierarchy? |
| A2: | All classes you create in Java are part of the hierarchy because the default superclass for the ... |
Read now
Unlock full access