You are not instantiating an interface. You are instantiating an anonymous class, which implements that interface.
Assuming, the code posted above is in the file Foo.java
, then you will see the following output by the compiler:
Foo.class
Foo$1.class
where Foo.class
is obviously the compiled Foo
class and Foo$1.class
is the compiled anonymous class which you used in the code.
You'll find the specifics in the Java Language Specification, Chapter 15.9.5. Anonymous Class Declarations