a It will print Hello World in the output. b It will generate compile-time errors. c It will throw runtime exceptions. d It will only print Hello. e None of above. Answer: c Explanation As explained in chapter 4, �The Servlet model,� the OutputStream of a response object is used for sending binary data to the client while the Writer object is used for sending character data. However, we cannot use both on the same response object. Since the JSP engine automatically gets the JspWriter from the response object to output the content of the JSP as character data, the call to getOutputStream() throws a java.lang.IllegalStateException. Thus,the correct answer is c.
Since JSP always get translated into Servlet first, in this case at the time of Servlet class compilation it will be having two streams (character stream by default and explicitly created byte stream in code) then it should throw compile time error (2nd option) why it's giving runtime error?