fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Main
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. import java.util.Scanner;
  13.  
  14. public class PlaneCollision {
  15.  
  16. public static void main(String[] args) {
  17.  
  18. double distance, planeSpeed, objectSpeed;
  19. double timeToCollision;
  20.  
  21. Scanner input = new Scanner(System.in);
  22. System.out.print("Enter distance of nearest object: ");
  23. distance = input.nextDouble(100);
  24. System.out.print("Enter speed of the plane: ");
  25. planeSpeed = input.nextDouble(5);
  26. System.out.print("Enter speed of the object: ");
  27. objectSpeed = input.nextDouble(2);
  28.  
  29. timeToCollision = distance / (planeSpeed + objectSpeed);
  30.  
  31. if (timeToCollision >= 10) {
  32. System.out.println("\nAvert object!");
  33. } else {
  34. System.out.println("\nEject passengers!");
  35. }
  36. }
  37. }
  38.  
  39.  
  40.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:12: error: illegal start of expression
		import java.util.Scanner;
		^
Main.java:12: error: not a statement
		import java.util.Scanner;
		                ^
Main.java:14: error: illegal start of expression
public class PlaneCollision {
^
Main.java:37: error: reached end of file while parsing
}
 ^
4 errors
stdout
Standard output is empty