Inheritance

Why Inheritance? Inheritance lets one class reuse the fields and methods of another. Instead of copying code, you say "this new class is a kind of that existing class." In Java, the keyword extends creates this relationship. The class being extended is the sup

8 lessons, each with runnable code in the browser.

  1. Extending a Class
  2. Calling super() in Constructors
  3. Overriding Methods
  4. Using super.method()
  5. Polymorphism and Dynamic Dispatch
  6. Overriding toString()
  7. Overriding equals()
  8. Is-A Hierarchies in Action

Compilearn home