If you inherit an abstract class, you have to provide implementations to all the abstract methods in it.
Java Programming Language Polymorphism in Java (Article) Polymorphism in Java (Program)
827Program:
abstract class Parent{ abstract void mother(); abstract void father(); } class Child extends Parent{ void mother(){ System.out.println("I am Your Mother"); } void father(){ System.out.println("I am Your father"); } public static void main(String args[]){ Parent obj1 = new Child(); obj1.mother(); Parent obj2 = new Child(); obj1.father(); } }
Output:
I am Your Mother I am Your father 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.