• Home
  • Java
    • Java Basics
  • Kafka
    • Producer
  • AWS
  • GoLang
  • About Me
mjpric3@gmail.com
Curriculum Vitae

The Code Standard

  • Home
  • Java
    • Java Basics
  • Kafka
    • Producer
  • AWS
  • GoLang
  • About Me

Inheritance

Basics

is one of the four pillars of Java. Its purpose is what it sounds like, to inherit some attributes and functionality from a super class or sometime referred to as “Parent” class to its child class. 

Benefit: 

  1. Allows us to share common code among sub-classes of the super class.
  2. Allows for more manageable code and refactoring.
  3. Allows for application to be more easily extendable.
  4. Maybe one of the most important things, is that it allows us to use Polymorphism. 

Example: An object is said to be a child if it has an “IS-A” Relationship with  another class. If it does, you may like to use the java keyword extends to inherit the fields and method of the super class. Here is a high-level example of some basic inheritance involving animals. Note that even though a Wolf and Dog extend the Canine class, they will inherit all attributes from the Canine class and the Mammal class. 

You also might be interested in

Best Languages To Begin With

Dec 22, 2018

So what programming language to start with? There are many[...]

Polymorphism

Jan 3, 2019

Polymorphism is a key component of Java’s Object Oriented Nature.[...]

What Is A Computer Program?

Dec 21, 2018

A computer program is a useful piece of code written[...]

Recent Posts

  • Producer
  • Interfaces
  • Abstraction
  • Polymorphism
  • Conditional Statements

Categories

  • Basics
  • Kafka
  • Welcome

© 2026 · thecodestandard.com

Prev Next