File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes setContentType Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "setContentType" Watch "setContentType" New topic


Ranjani Theyagarajan

Joined: Feb 08, 2006
Posts: 19

// insert code here...


which statement will intialize the out variable?

a) PrintWriter out=response.getWriter();
b) PrintWriter out=response.GetOutputStream();
c) OutputStream out=response.getOutputStream();
d) ServletOutputStream out=response.getServletOutput();

My answer is C. but the given answer is a.
I read somewhere that for binary data need to use getOutPutStream.
Please correct me if am wrong

Patrick Williams
Ranch Hand

Joined: Apr 03, 2005
Posts: 213
What is the source of this question (mock exam?)? I agree that C should be the answer given that you are setting the content type to be an image.

Patrick<br /> <br />SCJP/SCWCD/SCBCD/SCDJWS/SCEA<br /> <br />Currently working on:<br />SCJP 6
Ranjani Theyagarajan

Joined: Feb 08, 2006
Posts: 19
Thanks Patrick... I got a PDF from my friend which contains this one..
I agree. Here's the link:
subject: setContentType
It's not a secret anymore!