Polymorphism - DV's Coding Corner
 
public class parrot extends bird {
public void makesound() {System.out.println("repeat");}

public static void main(String args[]){
bird p=new parrot(); // Polymorphism
p.makesound(); 

}
}

class bird{
public void makesound(){};
}

Ouput:
repeat



Leave a Reply.