File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SCJP Study Exam Chapter 5 Question 15

 
Greg Morphis
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If the four fragments are inserted independently at line 4, which are true? (Choose all that apply)
A. All four will compile and execute without exception.
B. All four will compile and execute and throw an exception.
C. Some, but not all, will compile and execute without exception.
D. Some, but not all, will compile and execute and throw an exception.
E. When considering fragments II, III, and IV, of those that will compile, adding a try/catch block around line 6 will cause compilation to fail


The book says that D is correct due to the IOException and not importing the java.io.* package. But I think also that E is right..
Because line 6 is outside of the class.. what are you going to try{} ? Line 5 is outside the main method so that's wrong too and will cause a compile error.
Am I wrong in my thinking?
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Greg,

Oops - our mistake!

It should read "line 4" not "line 6".

Here is a link to a partial list of errata in the book:

http://www.coderanch.com/t/467890/java-programmer-SCJP/certification/Compiling-errata-SCJP

It's not complete, and it's hard to use, so starting today, I'm going to compile an easier-to-use errata list and publish it here on this forum.

Thanks for the kick in the pants

Bert
 
Greg Morphis
Greenhorn
Posts: 13
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just think it's awesome you guys are here to help! Thanks for the link!
 
Mala Gupta
Author
Ranch Hand
Posts: 281
9
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its commendable that the authors are available here to help a reader resolve all issues related to their book! What more can a reader ask for!

cheers
Mala
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I completely agree with Greg and Mala, when I saw the existence of javaranch in the book, I thought of it as a 'fairy-tale' that the authors would be here. Absolutely awesome!.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic