Page 1 of 1

About Question enthuware.ocpjp.v7.2.1360 :

Posted: Tue Feb 18, 2014 11:20 am
by EpicWestern
I thought it was a trick question because you can't extend some anonymous classes since there's no way to reference them.

I suppose you could argue that counts as "visibility" but it doesn't seem like quite the same concept to me.

Re: About Question enthuware.ocpjp.v7.2.1360 :

Posted: Tue Feb 18, 2014 9:03 pm
by admin
Yes, anonymous classes are not really visible in the sense that you mentioned. So you can exclude that as the question says.

HTH,
Paul.

Re: About Question enthuware.ocpjp.v7.2.1360 :

Posted: Sat Feb 27, 2016 1:18 pm
by Chen@ukr.net

Code: Select all

public class Outer {

    class Inner extends Outer.Inner.InnerInner{
        class InnerInner{}
    }
    
    public static void main(String[] args) {
        // TODO code application logic here
    }
    
}
will not compile.

Re: About Question enthuware.ocpjp.v7.2.1360 :

Posted: Sat Feb 27, 2016 8:29 pm
by admin
Well, it doesn't compile because of cyclic inheritance. Not because of any special restriction on an inner class. It applies to a regular class as well.
-Paul.