I wrote a simple code in the online java ide (follow code below):
import java.util.Scanner;
public class HelloWorld
{
public static void main(String[] args)
{
String nome = "Filipe";
final double minimo = 15;
Scanner let = new Scanner(System.in);
double n1;
System.out.print("Informe a primeira nota: ");
n1 = let.nextDouble();
double n2;
System.out.print("Informe a segunda nota: ");
n2 = let.nextDouble();
double n3;
System.out.print("Informe a terceira nota: ");
n3 = let.nextDouble();
double n = (n1 + n2 + n3)/3;
System.out.print("A media do aluno " + nome + " e " + n);
if (n < minimo) {
System.out.print("O aluno foi Reprovado");
}
else {
System.out.print("O aluno foi aprovado");
}
}
}
But at the time of compiling on ide online this occurred:
Informe a primeira nota: Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextDouble(Scanner.java:2413)
at HelloWorld.main(HelloWorld.java:23)
Does anyone know why?