Find a correct syntax

Report a typo

Here's an interface:

interface AnInterface {

    void method();
}

Select the correct syntax for creating an anonymous class.

a)

new AnInterface {

    @Override
    public void method() {
        // do something
    }
};

b)

AnInterface() {

    @Override
    public void method() {
        // do something
    }
};

c)

new AnInterface() {

    @Override
    public void method() {
        // do something
    }
};

d)

new AnInterface() {{

    @Override
    public void method() {
        // do something
    }
}};
Select one option from the list
___

Create a free account to access the full topic