I am not certain but I'll bite. You are creating an anonymous inner class which implements the interface 'Foo' and also provides the implementation of the method foof() (because it has a contract with Foo when it uses `implements`).
I'm certain that you're right.
This is one case in which we can type a new <InterfaceName> and the compiler does not complain.
I will just add that you are not only creating an on the spot implementation ( subclass ) of Foo, but also creating an instance of this subclass at the same time and passing this instance as an argument to the method doStuff.