Cole Mertz
Cole Mertz

Reputation: 23

Array elements cause ] expected error in java

I am actively working on a project in my CIS-162 class that requires multiple arrays, however whenever I attempt to compile I am met with a "] expected" error for every element within the array. What did I do wrong?

I've searched for answers across multiple platforms and attempted formatting my arrays to be exactly the same as theirs (format wise) to no avail.

private boolean[] bet = new boolean[9];
    bet[0] = false;
    bet[1] = false;
    ...
    bet[8] = false;

I should have a 1x9 array of boolean expressions should I not?

Upvotes: 0

Views: 58

Answers (1)

Abdessamad Azzouzi
Abdessamad Azzouzi

Reputation: 122

if you are in tha main_class, you sholdn't use private ....; use directly boolean[] bet =....

Upvotes: 1

Related Questions