Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question 43)

 
Timber Lee
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which jsp lines are correct?
1) <%! String myString=”Hello” %>
2) <% String myString=request.getServerName() %>
3) <%= out.print(“Hello” %>
4) <%= “Hello” %>
author's answer is only 4) . do you think so?
 
g madhava
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)<%! String myString=”Hello” %>
It needs to have a ; at the end like this
<%! String myString=”Hello”; %>
2) <% String myString=request.getServerName() %>
Same as above the ; is missing
3) <%= out.print(“Hello” %>
<%= means out.print so esssentially
it would be
out.print(out.print("Hello"));
which is not the way how it should be...
4) <%= “Hello” %>
This is the correct one as given by the author.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic