René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Inheritance [JAVA] | ||
Inheritance is one of two fundamental possibilites to build new classes from existing ones. The other one is
aggregation.
extendsextends is the reserved word in java that defines a inheritance between classes:
class B { // some constructors, // methods and // variables, } class D extends B { // new constructors, // methods and // variables, }
D is derived from B; it extends B with new methods, variables and constructors.
If a class does not explicitely extend another class, it implicitely extends the mother of all classes: java.lang.Object.
Synonymsnew class
Synonyms for the new class are
old class
Synonyms for the old class are
Inheriting a class
... yet to be finished ...
|