aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes method local inner class question from marcus green mock exam 1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "method local inner class question from marcus green mock exam 1" Watch "method local inner class question from marcus green mock exam 1" New topic
Author

method local inner class question from marcus green mock exam 1

Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442

The ans given is 1,2,3
But none of the answers are correct right?Coz method local inner class can't be declared as public,private,protected,static,as class is defined locally inside a method.Please correct me if I am wrong.
Thanks
Veena


SCJP1.4
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
*Winston Churchill
Vivek Nidhi
Ranch Hand

Joined: Aug 10, 2003
Posts: 133
I think you got some confusion with ordinary classes and inner classes.The ordinary class you can have no modifies other than public.In case of Inner classes u can have private, protected, public, default and static. U can refer with JLS for confirmation and plz read K&B, you will get every thing clear on this
Vivek Nidhi
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Veena --
You're right, method-local inner classes can't be public, protected, private or static. But looking at the code you've shown here, the inner class is outside of main(), at class scope; it's not a method-local class at all. Such a class can indeed have all these modifiers.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: method local inner class question from marcus green mock exam 1