Back to Code Walkthrough
Two Variables Point To The Same Array
Java code walkthrough · Question 29Code
Read carefully. What does this print?1import java.util.Arrays;23public class Main {4 public static void main(String[] args) {5 int[] a = {2, 4, 6};6 int[] b = a;78 a[1] = 9;9 b[2] = a[0] + a[1];1011 System.out.println(Arrays.toString(a));12 System.out.println(Arrays.toString(b));13 }14}