wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Mock Exam Question doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Mock Exam Question doubt " Watch "Mock Exam Question doubt " New topic
Author

Mock Exam Question doubt

Joshua Antony
Ranch Hand

Joined: Jun 05, 2006
Posts: 254
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?

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.

Answer given is B. Should'nt it be C since will return null for the first time and hence will result in NPE ?


SCJP,SCWCD, Into ATG now!
Xenon Parker
Greenhorn

Joined: Mar 06, 2008
Posts: 9
It should give a NullPointerException.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mock Exam Question doubt
 
Similar Threads
getSession(false) at first request
Session related Question
Question on HttpSession
another mock exam question
question about session?