Abstract class with abstract method

package pkgabstract.pkgclass;
abstract class A           //abstract class defined
{
abstract void callme(); // abstract method defined
void callmealsoo()
{
System.out.println("In non-abstract method but the class is abstract ");
}
}
class B extends A
{
void callme()
{
System.out.println("Abstract method call in inherited class B ");
}
}
public class AbstractClass
{
public static void main(String[] args)
{
B b = new B();
b.callme(); // calling abstract method
b.callmealsoo(); //calling method of abstract class
}
}

                        OUTPUT

Abstract method call in inherited class B
In non-abstract method but the class is abstract

No comments:

Post a Comment