• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

folders and packages

 
Jason Attin
Ranch Hand
Posts: 232
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, on page 46 of the OCA book question 14 says:
Given the following class in the file /my/directory/named/A/Bird.java
INSERT CODE HERE

Which of the following replaces INSERT CODE HERE if we compile from /my/directory?
a) package my.directory.named.a;
b) package my.directory.named.A;
c) package named.a;
d) package named.A;
e) package a;
f) package A;
g) Does not compile


My Answers were B and D, but apparently only D is correct. I would have thought B was correct too, why not?
Also, it might be worth noting that in the solution it says:
Option B is incorrect because package names are case sensitive, just like variable names and other identifiers.

Perhaps the authors meant to say "Option A"?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jason Attin wrote:I would have thought B was correct too, why not?

Because the question clearly mentions that you need to compile this class from /my/directory. So that can't be a part of the package statement. If it was, the source code file would have been /my/directory/my/directory/named/A/Bird.java.

Jason Attin wrote:Perhaps the authors meant to say "Option A"?

Of course not! Because option B is not a correct answer. The authors meant option C (as mentioned in the errata overview), because that looks exactly the same as the correct answer D, but only differs in the case (a versus A).

Hope it helps!
Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic