Opérations sur les tableaux

Assignation de tableau, références

public class ArrayDemoS2 {

	static void displayArray(int[] array) {
		for (int i = 0; i < array.length-1; i++) {
			System.out.print(array[i] + ",");
		}
		System.out.println(array[array.length-1]);
	}
	
	public static void main(String[] args) {

		int a[] = {1,2,3};
		int b[] = {4,5,6};

		System.out.println("Before");
		displayArray(a);
		displayArray(b);
		
		a = b;
		a[0] = 8;
		System.out.println("After");
		displayArray(a);
		displayArray(b);
	}

}