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. class Main {
  13.  
  14. public static void main(String[] args) {
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. // Random Number Generator
  23.  
  24. int h = (int) (Math.random() * 10 + 1);
  25.  
  26.  
  27.  
  28.  
  29. int happiness = h;
  30.  
  31.  
  32. switch (happiness) {
  33.  
  34.  
  35.  
  36. case 1 : System.out.println(":(");
  37.  
  38.  
  39.  
  40. break;
  41.  
  42.  
  43.  
  44. case 2 : System.out.println(":)");
  45.  
  46.  
  47.  
  48. break;
  49.  
  50.  
  51.  
  52. case 3 : System.out.println(":-|");
  53.  
  54.  
  55.  
  56. break;
  57.  
  58.  
  59.  
  60. case 4 : System.out.println("^_^");
  61.  
  62.  
  63. break;
  64.  
  65.  
  66.  
  67. case 5 : System.out.println("O_O");
  68.  
  69.  
  70.  
  71. break;
  72.  
  73.  
  74.  
  75. case 6 : System.out.println(":O");
  76.  
  77.  
  78.  
  79. break;
  80.  
  81.  
  82.  
  83. case 7 : System.out.println(">:(");
  84.  
  85.  
  86.  
  87. break;
  88.  
  89.  
  90.  
  91. case 8 : System.out.println("D:");
  92.  
  93.  
  94.  
  95. break;
  96.  
  97.  
  98.  
  99. case 9 : System.out.println(":D");
  100.  
  101.  
  102.  
  103. break;
  104.  
  105.  
  106.  
  107. case 10 : System.out.println(":P");
  108. }
  109. }
  110. }
  111. }
  112. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:14: error: Illegal static declaration in inner class Main
public static void main(String[] args) {
                   ^
  modifier 'static' is only allowed in constant variable declarations
1 error
stdout
Standard output is empty