• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chapter 10 Question 11 of SCJP K and B

 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Bharathula Venkata
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes True, I was also confused because the answer to the next question contradicts this....:-(
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic