GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Reg. Inner classes : Valiveru's exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Reg. Inner classes : Valiveru Watch "Reg. Inner classes : Valiveru New topic
Author

Reg. Inner classes : Valiveru's exam

Angela Narain
Ranch Hand

Joined: Apr 14, 2001
Posts: 327
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
Gagan Indus
Ranch Hand

Joined: Feb 28, 2001
Posts: 346
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>
 
GeeCON Prague 2014
 
subject: Reg. Inner classes : Valiveru's exam