Int array : Array « JSP « Java






Int array

<HTML>
  <HEAD>
    <TITLE>My First JSP</TITLE>
  </HEAD>

  <BODY>
    <H1>Using the if Statement</H1>
    <%
        int array[] = {1, 2, 3, 4, 5}, sum = 0;

        for (int i = 0;
            i < array.length;
            sum += array[i++]);

        out.println("The average = " + sum / array.length);
    %>
  </BODY>
</HTML>


           
       








Related examples in the same category

1.Demo for loop
2.Creating an Array
3.Using Multidimensional Arrays
4.Passing Arrays to Methods