public class example {
int i[] = {0};
public static void main(String args[]) {
int i[] = {1};
change_i(i);
System.out.println(i[0]);
}
public static void change_i(int i[]) {
int j[] = {2};
i = j;
}
}
when I run this program I get 1 .but my question is
what is the result of i=j; why it is not changing the value of i[] in the main method.
thanks
int i[] = {0};
public static void main(String args[]) {
int i[] = {1};
change_i(i);
System.out.println(i[0]);
}
public static void change_i(int i[]) {
int j[] = {2};
i = j;
}
}
when I run this program I get 1 .but my question is
what is the result of i=j; why it is not changing the value of i[] in the main method.
thanks