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 throws Exception
  9. {
  10. static Scanner scan=new Scanner(System.in);
  11. static int B=scan.nextInt();
  12. static int H=scan.nextInt();
  13.  
  14. static int area=0;
  15. static boolean flag=false;
  16. static{
  17. try
  18. {
  19. if(B<=0 || H<=0)
  20. {
  21.  
  22. flag=true;
  23. throw new Exception("Breadth and height must be positive");
  24. }
  25. else
  26. {
  27. area=B*H;
  28. System.out.println(area);
  29. }
  30.  
  31.  
  32.  
  33. }catch(Exception e)
  34. {
  35. if(flag)
  36. {
  37. System.out.println(e);
  38. }
  39.  
  40. }
  41. }
  42.  
  43. public static void main (String[] args) throws java.lang.Exception
  44. {
  45. Ideone i=new Ideone();
  46.  
  47. }
  48. }
Compilation error #stdin compilation error #stdout 0.07s 4386816KB
stdin
Standard input is empty
compilation info
Main.java:8: error: '{' expected
class Ideone throws Exception
            ^
1 error
stdout
Standard output is empty