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 Is this question wrong right?This question is from scjp preparation book. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Is this question wrong right?This question is from scjp preparation book." Watch "Is this question wrong right?This question is from scjp preparation book." New topic
Author

Is this question wrong right?This question is from scjp preparation book.

Ian Su
Greenhorn

Joined: Nov 18, 2010
Posts: 25
Hi,everyone,Is this question wrong right?I think,none of the answers is correct,right?
Given the following directory structure:


And given the contents of GetJar.java and 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 commands will compile GetJar.java and produce the output 8?
(Choose all that apply.)
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
Answer:
􀀂 ✓ A is correct. Given the current directory and where the necessary files are located, these
are the correct command line statements.
􀀂􀀁 B and D are wrong because javac MyJar.jar GetJar.java is incorrect syntax. C is wrong
because the -classpath MyJar.java in the java invocation does not include the test directory.
(Objective 7.5)

Including the classpath for GetJar and the necessary class path(Foo class) when executing GetJar will be correct I think.That is :

Am I right?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

Does this help -> http://www.coderanch.com/t/270643/java-programmer-SCJP/certification/Error-Sun-Certified-Programmer-Java


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Ian Su
Greenhorn

Joined: Nov 18, 2010
Posts: 25


Thank you,you consolidate my opinion!Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is this question wrong right?This question is from scjp preparation book.
 
Similar Threads
K&B doubt regarding question in Development chapter
Question related to self test question in SCJP (Sierra/Bates) Java 6 book
Confusion over java classpath
Mistake in GuideBook for SCJP Java 6.0, Chapter 10, Self Test question 11
Doubt at K&b chapter 10,question 11