Google+ Followers

Connect

Get Updates Via Email

Enter your email address:

Delivered by FeedBurner

Monday, 11 November 2013

Java Program: Inheritance Super Keyword

Program

class inheritance
{
 public static void main(String[] args)
 {
  apple a=new apple();
  a.disp();
 }
}
class fruit
{
 String f="fruit";
 public void disp()
 {
  System.out.println("Base Class "+f);
 }
}
class apple extends fruit
{
 String f="Apple";
 public void disp()
 {
  System.out.println("Derived Class  "+f);
  super.disp();
  System.out.println("Super Class "+super.f);
 }

}

Output


1 comment :

  1. I have read your blog its very attractive and impressive. I like it your blog.

    Java Online Training Java EE Online Training Java EE Online Training Java 8 online training Core Java 8 online training

    Java Online Training from India Java Online Training from India Core Java Training Online Core Java Training Online Java Training InstitutesJava Training Institutes

    ReplyDelete

Share this to your friends