What class files will be created during the compilation of the following code?

public class Count {
    class A { }

    public static void main(String[] args) {
        Object obj = new Object() {
            { System.out.println(this); }
class Count$1 { }
Files for inner classes are named Outer$Inner, for anonimous classes - Outer$1, Outer$2, ... But $ is a legal symbol for identifiers and class Count$1 was already declared. Therefore, obj variable will contain a pointer to the anonimous class Count$2. So, 4 files will be created.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Зарегистрируйся сейчас
или Подпишись на будущие тесты