This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Mock Exam Question doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Mock Exam Question doubt
 
Similar Threads
question about session?
getSession(false) at first request
another mock exam question
Session related Question
Question on HttpSession