Which of the following are true about inner classes A.Inner classes can only be instantiated in its outer class B.Inner classes can be protected or private C.Anonymous inner class can be both an explicit subclass and implements an interface. D.Anonymous inner classes declare and instantiated at the same place. E.An inner class can be static only when it's outer class is static. F.An instance of an Anonymous inner class can only be created in it's outer class What are the correct answers ? I assumed B, C, D
posted 14 years ago
i guess only B & D are correct A) Instance of Inner classes can be made , where they are accessible , using outer.new inner() C)Anonymous class can either implement an interface ( in dat case , they be extending from Object class ) OR extend a class , but NOT BOTH E) Inner class ( local or anonymous ) can be implicitly static , when its declared in static context ( like static initializer ) F) Instance of anonymous class can only be created at da place they r declared .
------------------ Gagan (/^_^\)
Gagan (/^_^\) SCJP2 SCWCD IBM486 <br />Die-hard JavaMonk -- little Java a day, keeps you going.<br /><a href="http://www.objectfirst.com/blog" target="_blank" rel="nofollow">My Blog</a>