<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">// play with passing arrays

public class array_params {
    public static void main(String args[]) {
	
	// initializer list to
	// instantiate array i
	int[] i = {1, 2, 3, 4};
	int[] j = {1, 2, 3, 4};

	// pass i to change method
	change(j);

	// print i
	print(i,j);

    } // method main
    
    public static void change(int[] x) {
	for(int i=0; i&lt;=x.length-1; i++)
	    x[i] = x[i]*x[i];
    } // method change

    public static void print(int[] x, int[] y) {
	System.out.println(" x \tx^2");
	System.out.println("===\t===");

	for(int i=0; i&lt;=x.length-1; i++)
	    System.out.println(x[i]+"\t"+y[i]);

    } // method print

} // class array_objects

/* Output
 x      x^2
===     ===
1       1
2       4
3       9
4       16
*/
</pre></body></html>