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

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 the sum

Which statement when placed at the location XXX can be used to compute the sum?

a. <% sum = sum + j %>
b. <% sum = sum + j; %>
c. <%= sum = sum + j %>
d. <%= sum = sum + j; %>





Answer: B


Learn More :