Understanding the important scenario of abstract class
Java Programming Language / Polymorphism in Java
1004Program:
abstract class Favourite{ abstract void color(); } //In real scenario, implementation is provided by others i.e. unknown by end user class Ram extends Favourite{ void color(){ System.out.println("I am Ram, My Favourite color is Red"); } } class Rahim extends Favourite{ void color(){ System.out.println("I am Rahim, My Favourite color is Green"); } } //In real scenario, method is called by programmer or user class Abstraction{ public static void main(String args[]){ Favourite s=new Rahim();//In real scenario, object is provided through method s.color(); } }
Output:
I am Rahim, My Favourite color is Green 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