fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. enum Statuses{
  7. OPEN(1, init(1)), CLOSE(2, init(2));
  8.  
  9. private final int value;
  10. private final int internalValue;
  11.  
  12. private Statuses(int v, int intv){
  13. this.value = v;
  14. this.internalValue = intv;
  15. }
  16.  
  17. static int init(int value){
  18. if (value == 2) throw new RuntimeException("this is a test");
  19. return value;
  20. }
  21. }
  22.  
  23. public static void main (String[] args) throws java.lang.Exception
  24. {
  25. System.out.println(Statuses.OPEN);
  26. }
  27. }
Runtime error #stdin #stdout #stderr 0.06s 380224KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.ExceptionInInitializerError
	at Main.main(Main.java:25)
Caused by: java.lang.RuntimeException: this is a test
	at Main$Statuses.init(Main.java:18)
	at Main$Statuses.<clinit>(Main.java:7)
	... 1 more