Choose correct constructor bodies to be inserted at line (1).

class Base {
    public Base(String s) {
        System.out.println("Base(" + s + ")");
    }
}

class Sub extends Base {

    private static final String CLASS_DUMMY_STRING = "CLASS_DUMMY_STRING";
    private final String INSTANCE_DUMMY_STRING = "INSTANCE_DUMMY_STRING";

    public Sub() {
          //(1)       
    }

    private static String getClassString() {
        return CLASS_DUMMY_STRING;
    }

    private String getInstanceString() {
        return INSTANCE_DUMMY_STRING;
    }
}
Explanation
You can't use non-static fields, results of non-static method calls, or pointer 'this' as arguments for a constructor of a parent class.
In this case constructor calls super(CLASS_DUMMY_STRING) and super(getClassString()) will be correct.

Следи за CodeGalaxy

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

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