• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock Exam Question doubt

 
Joshua Antony
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Xenon Parker
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should give a NullPointerException.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic