aspose file tools*
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
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
Author

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

Bhaarat Sharma
Ranch Hand

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

And given the contents of GoDeep.java and Foo.java:
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:
myApp/Foo.class
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??


omnipresent
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: http://aspose.com/file-tools
 
subject: Doubt about Question 12 in Chapter 10 Quiz (K&B)