Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Review Questions Chapter 1 Q.14 : OCAJP Study Guide by Jeanne and Scott

 
Rachit Kumar Saxena
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q)Given the following class in the file /my/Directory/named/A/Bird.java:

      
[/b]
Which of the following replaces INSERT CODE HERE if we compile from /my/directory?

The answer here is package named.A;

I think what is the need of the package here.If I am on /my/Directory on my cmd I would write like:

javac /my/Directory/Bird.java

Even if I write package named.A;.What difference does it make?How do I compile it then?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rachit,
This is a case where knowing too much can hurt you. On the OCA, you only have to know the VERY basics of compiling. Which means your example is out of scope. If this happens to you on the real exam and two answers are correct, think about which one requires you to assume less.

Luckily, the question doesn't try to trick you with that and there is no "package statement not required" answer! So you cna treat it "if this code is in a package, which would it be."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic