The string is invalid. It should have a space between "new" and "Foo":
new Foo() { public int bar(){ return 1; } }
This creates an instance of the anonymous type that implements Foo. See Java in a nutshell: Anonymous classes (section 3.12.3 describes the syntax).
Anonymous classes are often widely used with event listeners. See Swing Trail: Inner Classes and Anonymous Inner Classes (but ignore the Inner Classes discussed at the top of this section;)
Happy coding.
:
14 - fubar ( public int fubar(Foo foo)). , new ... - ( ), ( ) fubar. - . :
Foo aNewFoo = new Foo() { ... };
fuubar(aNewFoo);
, .
user166390