Dispatch Program In Java
Program Name:- dispatch.java
import java.io.*;
class a
{
void callme()
{
System.out.println("\nInside A's callme method");
}
}
class b extends a
{
void callme()
{
System.out.println("\nInside B's callme method");
}
}
class c extends b
{
void callme()
{
System.out.println("\nInside C's callme method");
}
}
class dispatch
{
public static void main(String args[])
{
a obj=new a();
b obj1=new b();
c obj2=new c();
a r;
r=obj;
obj.callme();
r=obj1;
obj1.callme();
r=obj2;
obj2.callme();
}
}
No comments:
Post a Comment