A
A
Andrey Kulagin2020-04-15 18:46:38
Java
Andrey Kulagin, 2020-04-15 18:46:38

Is it possible to create an anonymous class if the class does not have a default constructor?

Is it possible to create an anonymous class if the class does not have a default constructor?
The answer is yes, since the anonymous class does not use a constructor, so the class does not have a name. Correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-04-15
@andrew_1985

All classes always have a constructor. If you don't explicitly define it, the compiler will do it for you. Including for anonymous classes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question