Win a copy of The Business Blockchain this week in the Cloud forum!
    Bookmark Topic Watch Topic
  • New Topic

Mock exam question doubt?

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
Guys,



The question above is from David Bridgewater and the answer is given as E. I thought C?? won't the System.out.println write to the server console (log)???
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
oops...sorry moderators, actually when I tried posting it, it gave me some errors so I used my browser back button and resubmitted it again and later I found it to be duplicated. You can delete this post as I'll use the other one!
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Report post to moderator
I think E is the correct answer.

Note that the example is using two kind of scriptlets: declarations (<%! %> and scripting expressions (<% %>. The Date code is inside an scripting expression, so it will be put inside the _jspService method during translation. The other two blocks are declarations, which means they will be put outside the _jspService method. What is more, both blocks are declaring a jspInit method, which will be run only once during servlet initilization (that's why the second time you'll see no output in the log).

I hope I made myself clear.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing as duplicate of this thread. Please continue discussions there.
 
    Bookmark Topic Watch Topic
  • New Topic