fork download
  1. /* package whatever; // don't place package name! */
  2. Exercise2.java
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.Scanner;
  7. public class Exercise2 {
  8.  
  9. public static void main(String[] args)
  10. {
  11. Scanner in = new Scanner(System.in);
  12. System.out.print("Input the first number: ");
  13. double x = in.nextDouble();
  14. System.out.print("Input the second number: ");
  15. double y = in.nextDouble();
  16. System.out.print("Input the third number: ");
  17. double z = in.nextDouble();
  18. System.out.print("The average value is " + average(x, y, z)+"\n" );
  19. }
  20.  
  21. public static double average(double x, double y, double z)
  22. {
  23. return (x + y + z) / 3;
  24. }
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:2: error: class, interface, or enum expected
Exercise2.java
^
1 error
stdout
Standard output is empty