jQuery in Action, 2nd edition*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Two Packages in the Same Directory? 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 "Two Packages in the Same Directory?" Watch "Two Packages in the Same Directory?" New topic
Author

Two Packages in the Same Directory?

marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

The following is question #58 from Marcus Green's 1.2 Mock Exam No. 1.
(Note that two separate files are illustrated in the code.)

SOURCE: http://www.jchq.net/mockexams/exam1.htm


The answer is 4, with the explanation, "Using the package statement has an effect similar to placing a source file into a different directory. Because the files are in different packages they cannot see each other..."

I'm fine with the answer (4), but I'm questioning the justification provided: "Using the package statement has an effect similar to placing a source file into a different directory." Since these files are each supposed to be in their own package, aren't they required to be in different directories?

To me, the "similar to" wording would be applicable if both files were in a directory called "Class1," and the Base file didn't declare a package at all. But as the question reads, the problem here is more than just package declaration.

Am I reading too much into this, or am I missing something?

[ September 30, 2004: Message edited by: marc weber ]

(fixed for width)
[ September 30, 2004: Message edited by: Barry Gaunt ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
I tend to agree. Maybe "effect of" would have been a better choice than "effect similar to".

I guess Marcus will be around to beat us up


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

PS: Why is my original post so wide -- extending horizontally off the screen?



I tried saving it as a simple text file to get rid of any weird paragraph formatting, then re-pasting it, but it's still doing it. (Or is it just my browser?)
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Within [C0DE][/C0DE] tags there is no automattic wrapping. So you have to keep your lines short.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Barry Gaunt:
Within [C0DE][/C0DE] tags there is no automattic wrapping. So you have to keep your lines short.

Ah... Thank you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Two Packages in the Same Directory?
 
Similar Threads
A question from Marcus Green's mock exam
classes in different package
Marcus Green "package question"
Kind Attn:Marcus Green - Pl. clear doubt
Need help for Marcus exam No1 #58