File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Mock Exam Errata and the fly likes Marcus green exam 1 Question 30 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "Marcus green exam 1 Question 30" Watch "Marcus green exam 1 Question 30" New topic
Author

Marcus green exam 1 Question 30

Milind Deodhar
Ranch Hand

Joined: Dec 06, 2000
Posts: 32
public class MyClass1 {
public static void main(String argv[]){ }
/*Modifier at XX */ class MyInner {}
}
What are the valid modifiers at XX
the options are
public
private
static
friend.
The answer says that public, static and private are valid, but I think the local inner classes cannot have any access modifiers as they are local to method.
I even tried to compile and it gives an error
Am I correct?
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
The inner class here is not local to a method. Look at the line above and you will see that main has {} after it so MyInner is not part of method main.
Have to be careful to look at the code closely, this is an easy thing to miss.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Marcus green exam 1 Question 30
 
Similar Threads
Marcus Exam 1 question
Inner Class Accessibiltiy
ans to q-30 of Marcus green Mock-1 (SCjp 1.4)
method local inner class question from marcus green mock exam 1
to q-30 of Marcus green Mock-1 (SCjp 1.4)