Fill in the blanks to define a new class falcon based on the superclass bird
Answers
Answered by
5
class falcon extends Bird {
}
}
Answered by
0
Answer:
class bird
{
public void eat ( )
{
system. out. println ( " bird is eating " ) ;
}
}
class falcon extends bird // create a sub class or child class
{
public void eat ( )
{
system. out. println ( " falcon is eating " ) ; // override
}
}
class inheritance
{
public static void main ( string args [ ] )
{
falcon obj = new falcon ( ); // creating object of class falcon
obj. eat ( ) ;
}
}
this is a concept of inheritance.
Similar questions