Author name: javaplanet.io

Abstract Keyword and Abstract classes

Java provides a powerful mechanism to achieve abstraction using the abstract keyword. Abstraction is a process of hiding implementation details and exposing only the essential features of an object. This mechanism allows developers to define classes and methods without implementing them, ensuring a structure that subclasses must follow. What is the ‘abstract’ Keyword? The abstract …

Abstract Keyword and Abstract classes Read More »

Method Overriding

Method overriding is a concept in object-oriented programming (OOP) where a subclass provides a specific implementation of a method that is already defined in its superclass. The overriding method in the subclass should have the same name, return type, and parameter list as the method in the superclass. It allows a subclass to modify or …

Method Overriding Read More »

super keyword

The super keyword is a reference variable used to refer to the immediate parent class object. It is primarily used to access methods, constructors, and variables of the parent class from the subclass. Important Uses of ‘super’ keyword: Access Parent Class Constructor: The super() is used to call the constructor of the parent class. Access …

super keyword Read More »

Heirarichal Inheritance

Hierarchical Inheritance in Java is a type of inheritance in which a single superclass is extended by multiple subclasses. This means that multiple classes inherit properties and behaviors from a single parent class. Syntax: Program A simple Java program demonstrating Hierarchical Inheritance for a Software Engineer hierarchy. We will have a base class SoftwareEngineer and …

Heirarichal Inheritance Read More »

Multi Level Inheritance

What is Multi-Level Inheritance? Multi-level inheritance is a type of inheritance where a class derives from another derived class, forming a multi-level hierarchy. This forms a parent-child-grandchild relationship. Example Structure: Class A: Base Class Class B: Derived from Class A Class C: Derived from Class B Hierarchy:Class A → Class B → Class C Benefits …

Multi Level Inheritance Read More »

Single Inheritance

Inheritance is one of the four fundamental Object-Oriented Programming (OOP) principles, alongside Encapsulation, Polymorphism, and Abstraction. Inheritance allows a class to inherit properties and behaviors (methods) from another class. This enables code reusability and a logical hierarchy. What is Single Inheritance? Single Inheritance refers to a situation where a class (child or derived class) inherits …

Single Inheritance Read More »

Inheritance Types

Inheritance is a fundamental concept in object-oriented programming that allows a new class to inherit properties and behaviours from an existing class. There are several types of inheritance: Single Inheritance A class inherits from only one superclass.Single Inheritance Promotes simplicity and avoids ambiguity in method resolution. Multiple Inheritance A class inherits from more than one …

Inheritance Types Read More »

Object class

Java is a class-based, object-oriented programming language, and at the root of its class hierarchy is the Object class. This class is the superclass of all classes in Java, meaning every class implicitly inherits from the Object class unless it explicitly extends another class. The Object class is part of the java.lang package and provides …

Object class Read More »

Inheritance Introduction

Inheritance is a fundamental concept in object-oriented programming (OOP) that allows a new class, called the “subclass” or “derived class,” to inherit attributes and behaviors from an existing class, known as the “superclass” or “base class.” The derived class can reuse, extend, or override the functionalities of the base class. Key points about inheritance Code …

Inheritance Introduction Read More »

Scroll to Top