为什么程序会给出“非法启动类型"?错误?
问题描述:
这是相关的代码片段:
public static Rand searchCount (int[] x)
{
int a ;
int b ;
int c ;
int d ;
int f ;
int g ;
int h ;
int i ;
int j ;
Rand countA = new Rand () ;
for (int l= 0; l<x.length; l++)
{
if (x[l] = 0)
a++ ;
else if (x[l] = 1)
b++ ;
}
}
return countA ;
}
(Rand 是这个方法所在的类名)
(Rand is the name of the class that this method is in)
编译时得到这个错误信息:
when compiling it get this error message:
Rand.java:77: illegal start of type
return countA ;
^
这里出了什么问题?这个错误信息是什么意思?
what's going wrong here? what does this error message mean?
答
您在 return
语句之前放错了右大括号.
You have a misplaced closing brace before the return
statement.