interface toy{ // implicitly abstract
void color(); // implicitly public abstract
int a=1; // implicitly public static final
}
public class birdy implements toy {
public void color(){System.out.println("yellow");}
public void eat(){System.out.println("fruits");}
public static void main(String args[]){
birdy b1= new birdy();
toy b2=new birdy();
// toy b3=new toy(); //Error: Interface cannot be instantiated
b1.eat();
b2.color();
}
}
Output:
fruits
yellow