fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. FlipFlop ff = new FlipFlop();
  9. for (int i = 0; i != 10 ; i++) {
  10. System.out.println(ff.getCurrent());
  11. }
  12. }
  13. }
  14.  
  15. class FlipFlop {
  16. boolean isWhite;
  17. public String getCurrent() {
  18. isWhite = !isWhite;
  19. return isWhite ? "WHITE" : "BLACK";
  20. }
  21. }
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
WHITE
BLACK
WHITE
BLACK
WHITE
BLACK
WHITE
BLACK
WHITE
BLACK