Abstract class having constructor, data member, methods etc.
Java Programming Language Polymorphism in Java (Article) Polymorphism in Java (Program)
1860Program:
//example of abstract class that have method body abstract class Parent{ Parent(){ System.out.println("I am constructor of Parent class"); } abstract void abstractMethod(); void nonAbsract(){ System.out.println("I am non Abstart method"); } } class Child extends Parent{ void abstractMethod(){ System.out.println("This is implementation of abstract method"); } } class Abstraction{ public static void main(String args[]){ Parent obj = new Child(); obj.nonAbsract(); obj.abstractMethod(); } } Output:
Output:
I am constructor of Parent class I am non Abstart method This is implementation of abstract method 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.