Suppose we have the following code (from Dan's exam)
Why is class D considered anonymous class in this case? An anonymous class cannot be static says another explanation in the same exam... Can you help me on this? thanx attila
In the above code example, the reference to the anonymous class is static; but the anonymous class is not static. The reference, a1, is static so only one instance of the anonymous class will be created regardless of the number of instances of class C.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
In the above code class D is not anonymous. It is just a static inner class. The problem is with the anonymous class referred by satic A a1.It can't use implements key word.
Don't get me started about those stupid light bulbs.