Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Possibly misleading Master Exam question  RSS feed

Hareendra Reddy
Ranch Hand
Posts: 173
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
This is a question from master exam -1.
How we can deduce 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
Correct Answer
E: java -cp classes player.MusicPlayer
H: java -cp /mp/jars/cp.jar player.MusicPlayer
Ankit Garg
Posts: 9610
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)...
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!