+ 1
Why the answer to this questions is 2?
int[] arr ={1,2,3,4}; int x= arr[arr[ ]]; System.out.print(x);
9 Answers
+ 12
As we know array index starts from 0 so here it will start from 0
Int x = arr[arr[]] = arr[arr[0]];
value at location arr[0] is 1 so now
Int x= arr[arr[]] = arr[1];
Now value at location arr[1] is 2
Which is your output
+ 1
Is the square bracket empty?
+ 1
It's not even running, their is probably a 0 inside the bracket.
+ 1
Then bracket should contain 2 inside.
0
Yes
0
The empty space of the bracket must be filled.
0
Yes, where did you find that question from?
0
In a Sololearn challenge.
0
Te original question is:
Fill in the blank to output 4.