public class midterm2 {
static void methodOne(int[] a) {
int[] b = new int[5];
a=b;
System.out.print(a.length);
System.out.print(b.length);
}
public static void main(String[] args) {
int[] a = new int[10];
methodOne(a);
System.out.print(a.length);
}
}
The answer is 5510, and I don't understand why because I thought it would be 555. I thought the original array will be changed in this case.
Can anyone help me to understand this??
Thank you!