aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Possibly misleading Master Exam question 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 "Possibly misleading Master Exam question" Watch "Possibly misleading Master Exam question" New topic
Author

Possibly misleading Master Exam question

Hareendra Reddy
Ranch Hand

Joined: Jan 09, 2011
Posts: 173

Hello all,
This is a question from master exam -1.
How we can deduce MusicPlayer.java is in player package or not without looking at
source file,It is also possible to make a class and create the appropriate directory structure ...
and one more mistake using cpjar instead of mp.jar...

Question is as follows:

Given that the MusicPlayer project is on a UNIX system and consists of the following files:
/mp/player/MusicPlayer.java
/mp/classes/player/MusicPlayer.class
/mp/jars/mp.jar
Inside mp.jar file the structure is:
player/MusicPlayer.java
player/MusicPlayer.class
You are currently in the directory
/mp
and the CLASSPATH is set to
/mp/jars
What command(s) can you use to invoke the class player.MusicPlayer? (Choose all that
apply.)
Correct Answer
E: java -cp classes player.MusicPlayer
H: java -cp /mp/jars/cp.jar player.MusicPlayer
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9313
    
  17

This question has been asked before, you can try to search it. The answer is that the structure of the jar file is your clue that MusicPlayer is in player package. The directory structure in a jar has to be correct for the jar to work. In some cases on the exam you have to assume that things will work fine. Like in this case you'll have to assume that the jar is valid. Like if you get a question which has a code fragment where line numbers are starting from 5 or 10 (or any number other than 1), then you can assume that there are necessary import statements to make the code work (in case line numbers start from 1 then you know you'll have to check imports too)...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Possibly misleading Master Exam question