Core Java Tutorial

Define Java

C vs C++ vs Java

Java Virtual Machine

Java First Program

Java Data Types

Java Tokens

Java Keywords

Java Operators

Operator Precedence

Java Type Casting

Java Statement

Java If statement

Java Switch statement

Java Loops

Java Jumping Statement

Java Arrays 1D

Java Arrays 2D

Java Variable Size Array

Java Vector

Java Math Methods

Java String Methods

Java String Buffer

User-Defined Method

Java Method Overloading

Java Class & Object

Java Constructor

Java Inheritance

Java Interface

Java Packages

Java Multi-threading

Exceptional Handling

File Handling

Java Applets

Java DataBase Connectivity

Page Stats

Visitor: 197

Java Inheritance

Inheritance allows sub classes to inherit all the variables and methods of their parent classes.

Types of inheritance:

  1. Single Inheritance
  2. Multi-level Inheritance
  3. Hierarchical Inheritance
  4. Multiple Inheritance
Public Protected Friendly Private Protected Private
Same class Yes Yes Yes Yes Yes
Sub class in same package Yes Yes Yes Yes No
Other classes in same package Yes Yes Yes No No
Sub class in other package Yes Yes No Yes No
Non-sub class in other package Yes No No No No