Java Abstract Class Example


Program
abstract class Bird{ //Parent Class abstract void fly(); //use void fly(){} } public class Parrot extends Bird{ //Child Class void fly(){ System.out.print("Parrot can Fly "); } public static void main(String args[]){ Bird p=new Parrot(); p.fly(); } }
Input
Output