Java Language Tutorial:

Java Language Inheritance

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.

Java Language Inheritance Examples:

Related Java Language Tutorial Topics:

Other Tutorial Topics:

This modified content is an extract of the original Stack Overflow Documentation released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow. This topic was created and modified by the Stack Ovedrflow Contributor.