What will the following code display?

class Quizful {
    private static int count = 0;
    private final int id = ++count;

    private void print() {

    public void printOther(Quizful other) {
    public static void main(String[] args) {
        Quizful one = new Quizful();
        Quizful two = new Quizful();
Two objects of Quizful class will be created, first with field id = 1 and second with field id = 2. A reference to object 'one' will be passed to the printOther() method of object 'two'. Then print() of object 'one' will be called and 1 will be printed.

Следи за CodeGalaxy

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

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