以下是我的代码片段:
class Lines{
int nameMax() throws IOException{
// initialize variables
// These will be the largest number of characters in name
int namelen = 0;
//These will be the current word lenght.
int namelenx = 0;
...
while(name != null){
name = br.readLine();
namelenx = name.length();
...
if(namelenx > namelen) namelen = namelenx;
}
float nameleny = namelen/2; //Divides by 2 to find midpoint
namelen = Math.round(nameleny); //Value is rounded
return namelen;
}
}
我正在使用 BlueJ,每当我尝试运行它时,它都会在标题中显示错误并突出显示namelenx = name.length();
There are String variables forname
因为它是我剪切的代码的一部分。请帮忙解答。谢谢。