The author of the question, probably, wants you to realize that a 'write' "often" implicitly does not lead to a 'flush'. Hence B is more correct than C.
>>Couldn't writing 'theoretically' cause the response to be commited and >>hence cause and IllegalStateException if we try and forward the request? Good question. If you write a buffer > response.getBufferSize(), the OutputStream will automatically flush the stream, consequently leading you to IllegalStateException. So C can also be a correct answer. (not sure how to interpret 'often')
HFS authors allude to this on Pg 137, Para 3 of HFS book.
Joined: Dec 08, 2004
Hum ... so I wonder if this is a trick question?
Hopefully this kind of question where a 'well it's theoritically possible' answer doesn't come up on the exam
I don't think it's intended to be a trick question. The nice thing about the exam is that they tell you how many correct answers to choose. I believe they also try to avoid loose terms like "often" in the real exam questions (though I was not personally involved in writing those questions, so I can't say for sure).
(as an aside, in case anyone's paying extra close attention and matched my name to page xxxi of the book, I feel the urge to point out that I didn't write this particular question )
Co-Author of <a href="http://www.oreilly.com/catalog/jswing2" target="_blank" rel="nofollow">Java Swing</a><br />Co-Creator of <a href="http://www.sun.com/training/catalog/courses/CX-310-055.xml" target="_blank" rel="nofollow">SCJP 5.0</a> and <a href="http://www.sun.com/training/certification/java/associate_beta.xml" target="_blank" rel="nofollow">SCJA</a> exams
subject: HF SCJP mock exam question: flush() vs. write()