What will be the output of the following program?

Last Updated :
Discuss
Comments

What will be the output of the following program?

Java
int[] arr1 = {1, 2, 3};
int[] arr2 = arr1;
arr2[0] = 10;
System.out.println(arr1[0]);


1

10

Compilation Error


Runtime Error

Share your thoughts in the comments