1.interface Foo { 2. int bar(); 3.} 4.public class Beta { 5. class A implements Foo { 6. public int bar() {return 1;} 7. } 8. public int fubar( Foo foo ) {return foo.bar();} 9. public void testFoo() { 10. class A implements Foo { 11. public int bar() {return 2;} 12. } 13. System.out.println(fubar ( new A() ) ); 14. } 15. public static void main( String[] argv) { 16. new Beta().testFoo(); 17. } 18.}