ここに私のコードのスニペットがあります:
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();
ため、文字列変数が強調表示されます。name
役立つ回答をお願いします。ありがとう。