Runtime Polymorphism ( method overriding ) with Multilevel Inheritance
Java Programming Language / Class, Object and Methods in java
5258Program:
class Profession{ void check(){ System.out.println("profession class"); } } class Employee extends Profession{ void check(){ System.out.println("Employee class"); } } class Teacher extends Employee{ void check(){ System.out.println("Teacher class"); } public static void main(String args[]){ Profession obj1 ,obj2, obj3; obj1=new Profession(); obj2=new Employee(); obj3=new Teacher(); obj1.check(); obj2.check(); obj3.check(); } }
Output:
profession class Employee class Teacher class Press any key to continue . . .
This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS