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. enum Sex { MALE, FEMALE };
  13. class Greeter {
  14. void greet(Sex sex) {
  15. System.out.println(sex);
  16. }
  17. }
  18. new Greeter().greet(Sex.MALE);
  19. new Ideone().foo("me, of course");
  20. }
  21.  
  22. void foo(String who) {
  23. class Bar {
  24. void baz() {
  25. class Abc {
  26. void xyz() {
  27. System.out.println("foo(" + who + ").Bar.baz().Abc.xyz()");
  28. }
  29. }
  30. new Abc().xyz();
  31. }
  32. }
  33. new Bar().baz();
  34. }
  35. }
  36.  
Compilation error #stdin compilation error #stdout 0.11s 35620KB
stdin
Standard input is empty
compilation info
Main.java:12: error: enum types must not be local
		enum Sex { MALE, FEMALE };
		^
1 error
stdout
Standard output is empty