新しい単語が表示されるたびに、int
呼び出されたものに1を追加するメソッドを作成しました。total
public int GetTotal() throws FileNotFoundException{
int total = 0;
Scanner s = new Scanner(new BufferedReader(new FileReader("Particles/Names.txt")));
while(s.hasNext()){
if(s.hasNext()){
total++;
}
}
return total;
}
それはそれを書く正しい方法ですか?