If a class is declared abstract, it cannot be instantiated.
Java Programming Language Polymorphism in Java (Article) Polymorphism in Java (Program)
1338Program:
abstract class Human{ abstract void mother(); } class Woman extends Human{ void mother(){ System.out.println("I am Your Mother"); } public static void main(String args[]){ Human obj = new Human(); // wrong statement Human obj1 = new Woman(); obj1.mother(); } }
Output:
Woman.java:9: error: Human is abstract; cannot be instantiated Human obj = new Human(); ^ 1 error
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.