File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes mock exam question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "mock exam question" Watch "mock exam question" New topic
Author

mock exam question

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Feb 27, 2002
Posts: 17
Shan,
There can be no space between the % and the = . It must be <%= expression %>.
Regards,
Clark
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
Hi,
Try this link for more information on expressions.
-anthony
[ March 26, 2002: Message edited by: Anthony Villanueva ]
tony lee
Ranch Hand

Joined: Jan 21, 2002
Posts: 52
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


SCJP2, SCWCD
 
 
subject: mock exam question
 
Threads others viewed
cant/wont clear the counter out
Can you declare a function in a JSP page
Counter using Session Tracking !!
counter doesnt work
Query on Custom Tags
developer file tools