abstract class A { abstract void show(); } class B extends A { void show() { System.out.println("welcome"); } } class C extends A { void show() { System.out.println("java"); } } public class Main { public static void main(String arhs[]) { A a=new B(); } }
If you want to create a abstract object for the abstract class with the help of Derived class name
Parentclassname objectref=new Childclassname();