Asked by anonymous
why do we use the square brackets in arrays in java?
I google this same question but I don't understand the answers.
I google this same question but I don't understand the answers.
Answers
Answered by
oobleck
a scalar variable, such as x, holds a single value.
an array variable, such as x[2,4] holds 8 separate values, which can be used as a group, or individually.
If you're still googling, read about uses of arrays in java. You will find many code examples and what they do. Or, read the excellent java documentation first!
an array variable, such as x[2,4] holds 8 separate values, which can be used as a group, or individually.
If you're still googling, read about uses of arrays in java. You will find many code examples and what they do. Or, read the excellent java documentation first!