fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Media {
  6.  
  7.  
  8. public static void main(String[] args) {
  9. // TODO code application logic here
  10.  
  11. Scanner ent = new Scanner(System.in);
  12. double nota1, nota2, nota3;
  13. double media;
  14.  
  15. // recebe a 1º nota
  16. System.out.println("digite sua 1ª nota");
  17. nota1 = ent.nextDouble();
  18.  
  19. // recebe a 2º nota
  20. System.out.println("digite sua 2ª nota");
  21. nota2 = ent.nextDouble();
  22.  
  23. // recebe a 3º nota
  24. System.out.println("digite sua 3ª nota");
  25. nota3 = ent.nextDouble();
  26.  
  27. // calcula a média
  28. media = (nota1 + nota2 + nota3) / 3;
  29. System.out.println("A média do aluno é " + media);
  30.  
  31. }
  32.  
  33. }
  34.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:5: error: class Media is public, should be declared in a file named Media.java
public class Media {
       ^
1 error
stdout
Standard output is empty