Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Mock Exam Question  RSS feed

 
rakesh gaddam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I was going through one of the mock tests and I came across this question.

Given the following jsp line select the correct statements:
<% public void jspInit() { ...java code...} %>

1) It is a valid line that can be used to initialize the servlet that implements the jsp file.
2) It won't compile as no identifer can start with jsp not _jsp.
3) It will serve as the servlet initialization if the function's name is _jspInit.
4) There is no way to initialize a jsp's implementation class servlet.

When I checked the answers it says that option 1 is correct.

But the jspInit() method is defined in a scriptlet and not in a declaration.
Is there a printing mistake?Should it be <%! instead of <%.

Any comments....

Thanks
Rakesh.
 
Sreeraj G Harilal
Ranch Hand
Posts: 310
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's must be a printing mistake
 
rakesh gaddam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
Rakesh.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!