Java Program to show an inheritance example…

This java code is to show you a simple inheritance example.
class A
{
                int a;
                void aaa()
                {
                                System.out.println(“aaa”);
                }
}
class B extends A
{
                int b;
                void bbb()
                {
                                System.out.println(“bbb”);
                }             
}
class InheDemo
{
                public static void main(String args[])
                {
                                B ob1=new B();
                                ob1.aaa();
                                ob1.bbb();
                }

}

Add Comment