Implements the concept of Hierarchical inheritance in Java?



class a
{
 public void t()
{
System.out.println("okay");
}}
class a1 extends a
{
public void t1()
{
System.out.println("Good");
}}
class a2 extends a
{
 public void t2()
{
System.out.println("bye");
}}
class herir
{
public static void main(String args[])
{
 a1 obj1=new a1();
 obj1.t();
 obj1.t1();
 a2 obj2=new a2();
 obj2.t2();
 }}

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart