• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mock exam question

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the output of the following code?
<HTML>
<HEAD></HEAD>
<BODY>
<%! int counter; %>
<% counter = 100; %>
The number of hits <% = ++counter %>
</BODY>
</HTML>
/***********
The code will not compile since there is a space in the expression is not valid
Should it be like this...???
The number of hits <%=++counter%>
***********/
 
Clark Bruce
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shan,
There can be no space between the % and the = . It must be <%= expression %>.
Regards,
Clark
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Try this link for more information on expressions.
-anthony
[ March 26, 2002: Message edited by: Anthony Villanueva ]
 
tony lee
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i tried the code on tomcat4.1 after removed the space between % and =. it printed:
The number of hits 101 /***********
"/*********** " is outside of the body. why it still can show up?
tony
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic