File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Chapter 10 Question  11 of SCJP K and 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 "Chapter 10 Question  11 of SCJP K and B" Watch "Chapter 10 Question  11 of SCJP K and B" New topic
Author

Chapter 10 Question 11 of SCJP K and B

jose chiramal
Ranch Hand

Joined: Feb 12, 2010
Posts: 266
Foo.java:
package myApp;
public class Foo{public static int d =8;}

GetJar.java
public class GetJar{
public static void main(String[] args){
System.out.println(myApp.Foo.d);
}
}

test-|
-----|-GetJar.java
-----|-MyApp-|
-------------|-Foo.java

If the current directory is "test", and myApp/Foo.class is placed in a JAR file called MyJar.jar located in test, which set(s) of comments will compile GetJar.java and produce the output 8?

a. javac -classpath MyJar.jar GetJar.java
java GetJar
b. javac MyJar.jar GetJar.java
java GetJar
c. javac -classpath MyJar.jar GetJar.java
java -classpath MyJar.jar GetJar
d. javac MyJar.jar GetJar.java
java -classpath MyJar.jar GetJar


Whats the correct answer to the above question ? The book says A. I tried searching and it appears that the correct answere is : java -classpath MyJar.jar:. GetJar Please comment
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

Yes you are right jose, this problem has been reported to the authors and hopefully soon you'll see an errata of the SCJP 6 book...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Bharathula Venkata
Greenhorn

Joined: Jun 28, 2010
Posts: 5
Yes True, I was also confused because the answer to the next question contradicts this....:-(
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Chapter 10 Question 11 of SCJP K and B
 
Similar Threads
K&B doubt regarding question in Development chapter
Doubt at K&b chapter 10,question 11
Mistake in GuideBook for SCJP Java 6.0, Chapter 10, Self Test question 11
Question related to self test question in SCJP (Sierra/Bates) Java 6 book
Confusion over java classpath