For a given ServletResponse, which two retrieve an object for writing text data? A. response.getWriter() B. response.getOutputStream() C. response.getOutputWriter() D. response.getWriter().getOutputStream() E. response.getWriter(Writer.OUTPUT_TEXT)
I only see one alternative correct(obviously letter A), but the question asks for 2 answers.
Originally posted by Luis Torres: I have the question following:
For a given ServletResponse, which two retrieve an object for writing text data? A. response.getWriter() B. response.getOutputStream() C. response.getOutputWriter() D. response.getWriter().getOutputStream() E. response.getWriter(Writer.OUTPUT_TEXT)
I only see one alternative correct(obviously letter A), but the question asks for 2 answers.
Thanks
response.getWriter() and response.getOutputStream()
Since C, D, and E all use nonexistent methods, B has to be the other correct answer. I suppose since getOutputStream returns a ServletOutputStream, and that has methods that include print(String s) and println(String s), it's certainly possible to write text using a stream.
So, while A is clearly the best choice for writing text, B is also correct.
Hi, The correct options are: A. response.getWriter(): Returns a PrintWriter object that can send character text to the client. B. response.getOutputStream():Returns a ServletOutputStream suitable for writing binary data in the response.
So getwriter() seems to be perfect match ,as its asking for text to be written.
I am not young enough to know everything. - Oscar Wilde This tiny ad thinks it knows more than Oscar:
Free, earth friendly heat - from the CodeRanch trailboss