このプログラムを実行すると、エラー Exception in thread "main" java.lang.NumberFormatException: empty String が表示されます。何らかの方法で例外をスローすることでこれを機能させることは可能ですか、または try catch ステートメントを使用する必要がありますか?
private double[] scores3 = new double[5];
Scanner keyboard = new Scanner(System.in);
public void enterData()
{
double score;
double numberMin = 0;
double numberMax = 100;
do{
System.out.println("Enter the student's third test score");
while (!keyboard.hasNextDouble()) {
keyboard.next();
}
score3 = keyboard.nextDouble();
}
while (score3 <= numberMin || score3 >= numberMax);
double score3 = Double.parseDouble(keyboard.nextLine());