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 Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. fun(4);
  14. }
  15. public double SquareRoot( double value ) throws ArithmeticException
  16. {
  17. if (value >= 0) return Math.sqrt( value );
  18. else throw new ArithmeticException();
  19. }
  20.  
  21. public double func(int x) {
  22. double y = (double) x;
  23. try {
  24. y = SquareRoot( y );
  25. }
  26. catch(ArithmeticException e) { y = 0; }
  27. finally { --y; }
  28. return y;
  29. }
  30. System.out.println(y);
  31.  
  32. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
func(9)
compilation info
Main.java:30: error: <identifier> expected
System.out.println(y);
                  ^
Main.java:30: error: <identifier> expected
System.out.println(y);
                    ^
2 errors
stdout
Standard output is empty