File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes mock question 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 "mock question" Watch "mock question" New topic

mock question

kapil munjal
Ranch Hand

Joined: May 11, 2004
Posts: 298
Hi friends,

I was going through a mock of 1.2 and I came across this question.

Which cannot be used in declaring and initializing an automatic (method call) variable?
A. initialized arrays (such as {"Hello","Goodbye"})
B. final
C. public
D. constant of non-primitive type
E. inner class from other scopes

I have not been able to understand this question.

Please tell me what exactly is this question asking and what does it mean.


Kapil Munjal
SCJP 1.4, SCWCD 1.4
Shilpi M Ag
Ranch Hand

Joined: May 07, 2004
Posts: 40
I think the answer should be public.. variables in methods are not public... but not very sure!
Sanyev Babu
Ranch Hand

Joined: Dec 18, 2003
Posts: 132
You cannot declare a variable as public inside a method. Access modifiers are not applicable inside methods (for local variables) The only modifier that can be used on local variables is the final variable.
I agree. Here's the link:
subject: mock question
It's not a secret anymore!