Write a Java program to create object for abstract class

Write a Java program to create object for abstract class

Program
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();
    }
}

Output:

If you want to create a abstract object for the abstract class with the help of Derived class name
Parentclassname objectref=new Childclassname();


Abstract In Java



More Questions


138 . Abstract Practice Program 1
139 . Write a Java program to create object for abstract class
140 . Abstract Practice Program 2
141 . Abstract Practice Program 3
142 . Abstract Practice Program 4
143 . Abstract Practice Program 5
144 . Down Casting Program
145 . Write a Java-program using super.(dot)
146 . Write a Java-program with out using super() no parameterized
147 . Write a Java-program with out using super() with parameterized
148 . Write a Java-program with using polymorphism