• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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."
 
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic