So I've got this piece of code,
package test1;
class Student13
{
public static void main(String [] args)
{
Student13 p = new Student13();
p.start();
}
void start()
{
long [] a1 = {3,4,5};
long [] a2 = fix(a1);
System.out.print(a1[0] + a1[1] + a1[2] + " ");
System.out.println(a2[0] + a2[1] + a2[2]);
}
long [] fix(long [] a3)
{
a3[1] = 7;
return a3;
}
}
Can you tell me why it returns 15 15
and not 12 15
? Function fix
is applied only for long[] a2
, so how come that the final result is 15 15
?