Hi,
public class Qcb90 {
int a;
int b;
public void f() {
a = 0;
b = 0;
int[] c = { 0 };
g(b, c);
System.out.println(a + " " + b + " " + c[0] + " ");
}
public void g(int b, int[] c) {
a = 1;
b = 1;
c[0] = 1;
}
public static void main(String[] args) {
Qcb90 obj = new Qcb90();
obj.f();
}
}
Values of variables which we are passing to method wont be changed and we do know that array references can be modified by passing them to a method. here we are passing only 'b' and 'c[]'.
so b value wont be changed. as 'c' is an array it will be changed. we are not passing the variable 'a' as a parameter to method. so it get modified.
i hope im correct