• 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

How To Write A Computer Program

Dec 22, 2018

Before writing any computer program you will need to choose[...]

Learning Java

Dec 22, 2018

Java OOP Java is an object oriented programming language that[...]

Interfaces

Jan 25, 2019

Understanding Interfaces Interfaces are abstract classes. We don’t usually put the abstract keyword at[...]

Recent Posts

  • Producer
  • Interfaces
  • Abstraction
  • Polymorphism
  • Conditional Statements

Categories

  • Basics
  • Kafka
  • Welcome

© 2026 · thecodestandard.com

Prev Next