File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt about Question 12 in Chapter 10 Quiz (K&B) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt about Question 12 in Chapter 10 Quiz (K&B)" Watch "Doubt about Question 12 in Chapter 10 Quiz (K&B)" New topic

Doubt about Question 12 in Chapter 10 Quiz (K&B)

Bhaarat Sharma
Ranch Hand

Joined: Jun 04, 2007
Posts: 96
Given following directory structure:
|- GoDeep.class
|- test-|
|- MyJar.jar
|- myApp-|

And given the contents of and
3. public class GoDeep {
4. public static void main(String[] args) {
5. System.out.println(myApp.Foo.d);
6. }
7. }
3. package myApp;
4. public class Foo { public static int d = 8; }

And MyJar.jar contains the following entry:
If the current directory is x, which commands will successfully execute GoDeep.class and
produce the output 8? (Choose all that apply.)
A. java GoDeep
B. java -classpath . GoDeep
C. java -classpath test/MyJar.jar GoDeep
D. java GoDeep -classpath test/MyJar.jar
E. java GoDeep -classpath test/MyJar.jar:.
F. java -classpath .:test/MyJar.jar GoDeep
G. java -classpath test/MyJar.jar:. GoDeep

Why is option C not valid here??

Emanuele Ghe
Ranch Hand

Joined: Feb 04, 2009
Posts: 111
Hi Bhaarat.

The answer C is not valid because the java command will not find the class GoDeep, because the '.' is not included in the classpath.

SCJP6 with score 90%. I am conscious of my ignorance and ready to learn from everyone.
I agree. Here's the link:
subject: Doubt about Question 12 in Chapter 10 Quiz (K&B)
jQuery in Action, 3rd edition