0
What is output of this code?
public class Program { public static void main(String[] args) { int[ ][ ] sample = { {1, 2, 3}, {4, 5, 6} }; int x = sample[0][0]; System.out.println(x); } }
5 odpowiedzi
+ 2
Did you try to get this? This is two dimensional array.
Here sample[0][0] means index i = 0, index j = 0 so value will be 1;
Check this:-
https://www.google.com/amp/s/www.geeksforgeeks.org/multidimensional-arrays-in-java/amp/
0
:)
0
Correct 👍
0
Sarvar Khidirov If you know that why are you asking? Please don't waste our time.
0
If you only want to know the output, you can test the code in Code Playground. If you want the explanation for it, then ask for explanation rather than "What is the output of this code?".
BTW you should've tagged Java in your question. For future reference, please follow this guide to posting a question 👍
https://www.sololearn.com/Discuss/333866/?ref=app