0
What happened in this 42 number example in discription
public class Program { public static void main(String[] args) { int[ ][ ] myArr = { {1, 2, 3}, {4}, {5, 6, 7} }; myArr[0][2] = 42; int x = myArr[1][0]; System.out.println(x); } }
2 Respostas
+ 2
42 replaced 3 in the array
Before:
{ {1, 2, 3}, {4}, {5, 6, 7} }
After:
{ {1, 2, 42}, {4}, {5, 6, 7} }
myArr[0][2] means the third element(3) of the first element of myArr ({1, 2, 3}).
+ 1
Thanks