Passing Arrays In Jsp Methods <%! void Addition(int [] a) { for (int i = 0; i < a.length;i++) { a[ i ] += 2; } } %> |
<% int array[] = {2, 4 , 3, 6, 8}; out.println("Before the call to Addition... "); for (int i = 0; i < array.length; i++) { out.println("array[" + i + "] = " + array[i] + " "); } Addition(array); out.println("After the call to Addition... "); for (int i = 0; i < array.length; i++) { out.println("array[" + i + "] = " + array[i] + " "); } %> |