Reputation: 37
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);
Upvotes: 3
Views: 85
Reputation: 1107
These statements make no sense:
fullOfBool(boolean[] test1);
fullOfBool(boolean[] test2);
fullOfBool(boolean[] test3);
try with just
fullOfBool(test1);
fullOfBool(test2);
fullOfBool(test3);
Upvotes: 4