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