123456789101112131415



Question 1: Assume that you need to write a JSP page that adds numbers from one to ten, and then print the output.

<% int sum = 0;
for(j = 0; j < 10; j++) { %>
// XXX --- Add j to sum
<% } %>
// YYY --- Display ths sum

Which statement when placed at the location XXX can be used to compute the sum. Select the one correct statement

1. <% sum = sum + j %>
2. <% sum = sum + j; %>
3. <%= sum = sum + j %>
4. <%= sum = sum + j; %>