jQuery in Action, 2nd edition*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes SCJP Study Exam Chapter 5 Question 15 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 "SCJP Study Exam Chapter 5 Question 15" Watch "SCJP Study Exam Chapter 5 Question 15" New topic
Author

SCJP Study Exam Chapter 5 Question 15

Greg Morphis
Greenhorn

Joined: Apr 01, 2011
Posts: 13

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

Joined: Oct 14, 2002
Posts: 8815
    
    5
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


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Greg Morphis
Greenhorn

Joined: Apr 01, 2011
Posts: 13
I just think it's awesome you guys are here to help! Thanks for the link!
Mala Gupta
Author
Ranch Hand

Joined: Sep 27, 2002
Posts: 251
    
    9
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


Author of Manning's OCA Java SE 7 Programmer I Certification Guide and OCP Java SE 7 Programmer II Certification Guide
Ikpefua Jacob-Obinyan
Ranch Hand

Joined: Aug 31, 2010
Posts: 394

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!.


OCPJP 6.
In Your Pursuit Towards Certification, NEVER Give Up.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: SCJP Study Exam Chapter 5 Question 15