A class that has no name is known as anonymous class. Java Anonymous class can be created in two ways:
For more information please read https://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html#accessing
Anonymous classes enable you to make your code more concise. They enable you to declare and instantiate a class at the same time. They are like local classes except that they do not have a name. Use them if you need to use a local class only once.