why do we use the square brackets in arrays in java?

I google this same question but I don't understand the answers.

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!