0

Why does myarr[1][0] still print if i changed it to x? What purpose does this have? Thanks

public class Program { public static void main(String[] args) { int[ ][ ] myArr = { {1, 2, 3}, {4}, {5, 6, 7} }; int x = myArr[1][0]; System.out.println(myArr[1][0] + x); } }

9th Jul 2017, 2:10 PM
D_Stark
D_Stark - avatar
3 odpowiedzi
+ 4
Uhhh first of all Why you think that it can't be printed?
9th Jul 2017, 2:21 PM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
0
becusse i have changed myArr[1][0] now to x?
9th Jul 2017, 3:36 PM
D_Stark
D_Stark - avatar
0
wait... if i put myArr[1][0] = 100; then that will change its value.. its ok figured it out
9th Jul 2017, 3:47 PM
D_Stark
D_Stark - avatar