JSP: Utiliser tableau comme paramètre d’une méthode

Author:
 
<HTML>
  <HEAD>
    <TITLE>Passing Arrays to Methods</TITLE>
  </HEAD>
 
  <BODY>
    <H1>Passing Arrays to Methods</H1>
    <%!
    void doubler(int a)
    {
        for (int i = 0; i < a.length;i++) {
            a[ i ] *= 2;
        }
    }
    %>
 
    <%
        int array[] = {12345};
 
        out.println("Before the call to doubler...<BR>");
        for (int i = 0; i < array.length; i++) {
            out.println("array[" + i + "] = " + array[i] + "<BR>");
        }
        doubler(array);
        out.println("After the call to doubler...<BR>");
        for (int i = 0; i < array.length; i++) {
            out.println("array[" + i + "] = " +
                array[i] + "<BR>");
        }
    %>
  </BODY>
</HTML>
           
       

Cet article JSP: Utiliser tableau comme paramètre d’une méthode est apparu en premier sur .