0
[Java] I have problem to understand the arrays ?
What is arrays and what it using for ? Can anyone explain it using some examples.
3 Antworten
+ 1
Also imagine you are making a chess game for 8 by 8 board. You would use 2 dimensional array to track the board pieces. It would be the most wise data type to use
0
It is a fixed size of same types, not sure what you don't understand
0
Imagine you want to store 20 numbers, Strings or whatever.
Using 20 variables is possible but too much work.
Arrays are like containers/lists with a fixed size.
int myArray[] = new int[20]
Now you can use this array to store your 20 values.
And you can do many other stuff like sorting, searching for a value...
Here is a good tutorial with examples:
http://tutorials.jenkov.com/java/arrays.html