Java examples for Object Oriented Design:interface
Using Anonymous Inner Classes to implement an interface
public class AnonClass { public static void main(String[] args) { Ball b = new Ball() { public void hit() { System.out.println("You hit it!"); }/*from ww w . j a v a2 s . c o m*/ }; b.hit(); } } interface Ball { void hit(); }