- 1
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][1]; System.out.println(x); } } why it does not give any garbage value as output?
4 Respostas
0
your array is 3 dimention int[][][]
and your output would be myArr[0][2] = 3
0
myArr[1][1] is not exist. only [1][0] is exist and the value is 4. In the next, [2][0] is 5, [2][1] is 6 ... understand?
0
You code can't run,because the element was not defined.
0
it will give the output as 0