Java Language Inheritance

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

Inheritance is a basic object oriented feature in which one class acquires and extends upon the properties of another class, using the keyword extends. For Interfaces and the keyword implements, see interfaces.

Syntax

  • class ClassB extends ClassA {...}
  • class ClassB implements InterfaceA {...}
  • interface InterfaceB extends InterfaceA {...}
  • class ClassB extends ClassA implements InterfaceC, InterfaceD {...}
  • abstract class AbstractClassB extends ClassA {...}
  • abstract class AbstractClassB extends AbstractClassA {...}
  • abstract class AbstractClassB extends ClassA implements InterfaceC, InterfaceD {...}

Remarks

Inheritance is often combined with generics so that the base class has one or more type parameters. See Creating a Generic Class.



Got any Java Language Question?