+ 2
Explain this code plz...
public class Program { public static void main(String[] args) { int a[]= {1,5,6,2,3,4}; System.out.println(a[a[3]]); } }
2 odpowiedzi
+ 8
This is just based on indexing bro
In strings , every element has a specific index.
In your string the indexing is like this :
{ 1 , 5 , 6 , 2 , 3 , 4 }
0 1 2 3 4 5 = indexing
This is left to right indexing starting from 0
Now .printIn(a[a[3]])
It first access the 4th element that has index 3
a[3]=2
Now .printIn(a[2])
It then access the 3rd element that has index 2
a[2] = 6
Hence 6 is the output
Thanks
+ 2
Thankyou Prince PS it helps