aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Marcus Green's Mock question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Marcus Green Watch "Marcus Green New topic
Author

Marcus Green's Mock question

Yi Dong
Greenhorn

Joined: May 19, 2003
Posts: 22
Question 30)
public class MyClass1 {public static void main(String argv[]){ }/*Modifier at XX */ class MyInner {}}
What modifiers would be legal at XX in the above code?
1) public
2) private
3) static
4) friend

The answer is 1,2,3.
I thought local inner class may not have any access modifier and static modifier. Can anybody explain it ?
Thanks
Yi
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Why do you think it is a local inner class? Maybe if we straighten it out...


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Yi Dong
Greenhorn

Joined: May 19, 2003
Posts: 22
Sorry I thought the class is within the main method. It is not.
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
Yi, A lot of people have made that assumption. I don't know if I should modify the layout to make it more clear, or leave it like it is just as a warning on how easy it is to mis-read even small amounts of code .
Marcus


SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
I think you should leave it exactly the way it is.
La Vish
Ranch Hand

Joined: Apr 17, 2002
Posts: 161
Marcus,just leave those questions as they are!
They are interesting as they are now.


La Vish
SCJP 1.4, President 60s Club
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Marcus Green's Mock question