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 enum State {
  11. START(0), END(1);
  12. final int order;
  13. State(int order) { this.order = order; }
  14.  
  15. boolean isAfter(State state) {
  16. return this.order > state.order;
  17. }
  18. boolean isBefore(State state) {
  19. return this.order < state.order;
  20. }
  21. }
  22.  
  23. public static void main(String[] args) {
  24. State currentState = State.START;
  25. System.out.println(State.END.isAfter(currentState));
  26. System.out.println(currentState.isBefore(State.END));
  27. System.out.println(currentState.isAfter(State.END));
  28. System.out.println(State.END.isBefore(currentState));
  29. }
  30. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
true
true
false
false