Wednesday, 21 March 2018

Super Keyword in java





package superkeyword;



class mamal

{

public String color="blue";



public void eat()

{

    System.out.println("It eats.....");

}

public void reproduces()

{

    System.out.println("It gives birth to a new living being.....");

}





}



class blueWhale extends mamal

{

 

public String Color=super.color;   

public void swim()

{

    System.out.println("It swims in sea.......");

}

   

public void allactions()

{

    super.eat();

    super.reproduces();

    swim();



}





}













public class Superkeyword {



 

    public static void main(String[] args)

   

    {

       

        blueWhale bw=new blueWhale();

        System.out.println("color is "+ bw.Color);

        bw.allactions();

   

    }

   

}


No comments:

Post a Comment

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...