The value of a field

Report a typo

Here's a class containing two instance initialization blocks.

class A {

    int field = 2;

    {
        field++;
    }

    public A() {
        field = 8;
    }

    {
        field++;
    }
}

We have created an instance of the class.

A instance = new A();

What is the value of field?

Select one option from the list
___

Create a free account to access the full topic