wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How to tackle ambiguous questions like these ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How to tackle ambiguous questions like these ?" Watch "How to tackle ambiguous questions like these ?" New topic
Author

How to tackle ambiguous questions like these ?

Shailendra Guggali
Ranch Hand

Joined: Feb 01, 2001
Posts: 86
How can you declare i so that it is not visible outside the package 'test'.
package test;
class Test
{
XXX int i;
/* lot of code */
}
Private; Protected ; Public; No access modifier; Friend
THE ANSWER IS : Private
they say that it is not explicitly said that it has to be accessible from the package too.
Do they ask such questions in the real exam ???
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
The real exam is more clear with what they expect. You will get questions like these, but they will say what is the least restrictive access modifier you can give if you don't want "i" to be seen outside of the package test. Which would be "no access modifier" which I think the exam sometimes says something like, leave it as it is or don't do anything.
For the question above, I like the "no access modifier" answer better. Private will work, but as you pointed out, "no access modifier" would work also.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to tackle ambiguous questions like these ?
 
Similar Threads
jqplus
Need Clarification on Mock SCJP Exam Questions
style guide - views
Could the static keyword cause a bottleneck/ deadlock?
top level private class