Anonymous classes are useful when simple, one-off objects need to be created. They can be used in place of a full class definition.
They can everything a normal class can: pass arguments through to their constructors, extend other classes, implement interfaces, use traits.
Anonymous classes are assigned a name by the engine, This name has to be regarded an implementation detail, which should not be relied upon.