Simple Inheritance
// Simple Inheritance
class A
{
void fnDisplay()
{
System.out.println("Hello");
}
}
class B extends A
{
void fnShow()
{
System.out.println("Welcome");
}
}
class Inheritance_Demo
{
public static void main(String as[])
{
B obj = new B();
obj.fnDisplay();
obj.fnShow();
}
}
// Sample Output
>javac Inheritance_Demo.java
>java Inheritance_Demo
Hello
Welcome
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu