public class Ex4 { public void foo(int a[]) { a[0] = 3; } public static void main(String[] args) { int x[] = {2}; Ex4 thing = new Ex4(); thing.foo(x); System.out.println("x[0] is "+x[0]); } }