This question has already been answered:

Please explain what anonymous classes are, preferably by example, otherwise I can’t understand their working principles.

Reported as a duplicate by pavlofff , Denis , Harry , post_zeew , Community Spirit 13 Nov '16 at 15:43 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

    1 answer 1

    public class Foo { Foo(String param) {}; public static void main(String... s) { new Foo(s[0]){}; } } 

    Where Foo is anonymous with the impossibility of describing the constructor, i.e. local class with no name.