Consider the following JSP code (See exhibit).What will it print for the very first request to this page as well as the web application that contains this page? <html><body><% Integer count = (Integer) request.getSession(false).getAttribute("count"); if(count != null ) { out.println(count); } else request.getSession(false).setAttribute("count", new Integer(1));%>Hello!</body></html>
Select 1 correct option.
A.It will print Hello!
B.It will print Hello and will set the count attribute in the session.
C.It will throw a NullPointerException at request time.
D.It will not compile.
My answer was C.. as request.getSession(false) returns null at the very first request.. as null.set/getAttribute() results.. NullPointerexception.. right? But the answer given is B..
Could any help on this?
ThanksInAdvance