Saturday, February 28, 2009

Simple example to demonstrate java inheritance



package oops;
class Superclass
{
void display()
{
System.out.println("hi");
}
}
public class Subclass extends Superclass{
public static void main(String arg[])
{
Subclass ie=new Subclass();
ie.display(); // hi
}
}



0 comments:

Post a Comment