fork download
  1. //*******************************************************************
  2. // NOTE: please read the 'More Info' tab to the right for shortcuts.
  3. //*******************************************************************
  4.  
  5. import java.lang.Math; // headers MUST be above the first class
  6. import java.util.Scanner;
  7.  
  8. // one class needs to have a main() method
  9. public class HelloWorld
  10. {
  11. public static void main(String[] args) {
  12. System.out.println("Enter the scores:");
  13. Scanner scanner = new Scanner(System.in);
  14. int n = scanner.nextInt();
  15. int total = 0;
  16. int count = 0;
  17. while (n != -1) {
  18. total += n;
  19. count++;
  20. n = scanner.nextInt();
  21. }
  22. int calc = (total / count);
  23. System.out.println(calc);
  24. }
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:9: error: class HelloWorld is public, should be declared in a file named HelloWorld.java
public class HelloWorld
       ^
1 error
stdout
Standard output is empty