This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
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:
Inside mp.jar file the structure is:
You are currently in the directory
and the CLASSPATH is set to
What command(s) can you use to invoke the class player.MusicPlayer? (Choose all that
E: java -cp classes player.MusicPlayer
H: java -cp /mp/jars/cp.jar player.MusicPlayer
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)...