File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes JavaCaps Test 2, Question # 33 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "JavaCaps Test 2, Question # 33" Watch "JavaCaps Test 2, Question # 33" New topic

JavaCaps Test 2, Question # 33

Tina Ang
Ranch Hand

Joined: Mar 12, 2002
Posts: 58
Hello! Could anyone please explain why the answer is C) While writing to the stream f.write(buffer[i]) throws an IOException

Thank you!
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5382
Its answer has nothing to do with IO.

what will it print?
[ April 23, 2002: Message edited by: Ravish Kumar ]

"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
John Wetherbie

Joined: Apr 05, 2000
Posts: 1449
f1 is an alias for f. That is, the object references with the names f and f1 refer to the same object. So f1.close() is the same as f.close(). When you try to write with a closed Writer you receive an IOException.

The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
I agree. Here's the link:
subject: JavaCaps Test 2, Question # 33
jQuery in Action, 3rd edition