0

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?

3
  • 1
    Are you assigning inside a method? Commented Oct 24, 2019 at 14:56
  • I second Maroun's question. It sounds like you're trying to do this outside of the confines of curly brackets {} Commented Oct 24, 2019 at 15:00
  • I am assigning as an instance variable Commented Oct 24, 2019 at 15:05

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

I am within a separate class, there is no main method currently.
give the table values at the creation moment like : private boolean[] bet = new boolean[]{true,false .....}; or in the constructor and methods.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.