3

My question is two fold; One is I receive a bunch of .class errors when trying to compile my program, most other questions I find say that a missing bracket is the reason but all my brackets are matched. Two what is a .class error in this particular format?

Code:

class Simple
{
    public static void main (String [] args)
    {
        boolean [] test1 = { false, true, true, true } ;
        boolean [] test2 = { true } ;
        boolean [] test3 = { true, true, true, true, false } ;

        fullOfBool(boolean[] test1);
        fullOfBool(boolean[] test2);
        fullOfBool(boolean[] test3);

    }

    static void fullOfBool(boolean[] a)
    {
        for (int i = 0; i < a.length; i++)
        {
            if (a[i] == true)
            {
                System.out.println("The first true is at position" + i);
                break;
            }
        }

        for (int i = a.length - 1; i >= 0; i--)
        {
            if (a[i] == true)
            {
                System.out.println("The last true is at position" + i);
                break;
            }
        }
    }
} 

The errors I am receiving:

Simple.java:12: error: '.class' expected
        fullOfBool(boolean[] test1);
                             ^
Simple.java:12: error: ';' expected
        fullOfBool(boolean[] test1);
                                  ^
Simple.java:13: error: '.class' expected
        fullOfBool(boolean[] test2);
                             ^
Simple.java:13: error: ';' expected
        fullOfBool(boolean[] test2);
                                  ^
Simple.java:14: error: '.class' expected
        fullOfBool(boolean[] test3);
                             ^
Simple.java:14: error: ';' expected
        fullOfBool(boolean[] test3);
  • 1
    What do you mean by "a .class error"? That's not a thing. What is the exact message you're getting. – Dici Dec 16 '18 at 22:00
  • Added the exact message – PrezCulprit Dec 16 '18 at 22:02
  • Cool, always include the most detailed information in your questions ^^ nitowa probably gave you the right answer. Last comment: `blabla == true` is equivalent to just saying `blabla`. – Dici Dec 16 '18 at 22:09
  • 1
    Possible duplicate of [How to call a method in java?](https://stackoverflow.com/questions/3713643/how-to-call-a-method-in-java) – azro Dec 16 '18 at 22:09

1 Answers1

4

These statements make no sense:

fullOfBool(boolean[] test1);
fullOfBool(boolean[] test2);
fullOfBool(boolean[] test3);

try with just

fullOfBool(test1);
fullOfBool(test2);
fullOfBool(test3);
nitowa
  • 1,079
  • 2
  • 9
  • 21