File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Marcus Green's Mock question

 
Yi Dong
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you think it is a local inner class? Maybe if we straighten it out...
 
Yi Dong
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I thought the class is within the main method. It is not.
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should leave it exactly the way it is.
 
La Vish
Ranch Hand
Posts: 161
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marcus,just leave those questions as they are!
They are interesting as they are now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic