Java Interface Example


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