fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.Scanner;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. public class DoLoop
  10. {
  11. public static void main(String[] args)
  12. {
  13. Scanner in = new Scanner(System.in);
  14.  
  15. double value;
  16. do
  17. {
  18. System.out.print("Enter a number >= 0: ");
  19. value = in.nextDouble();
  20. }
  21. while (value < 0);
  22. double root = Math.sqrt(value);
  23. System.out.println("The square root of the number is " + root);
  24. 23 }
  25. 24 }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:24: error: not a statement
 23     }
 ^
Main.java:24: error: ';' expected
 23     }
   ^
Main.java:25: error: illegal start of type
 24  }
 ^
Main.java:25: error: ';' expected
 24  }
   ^
Main.java:25: error: reached end of file while parsing
 24  }
      ^
5 errors
stdout
Standard output is empty