java.lang.Enum>

public enum Direction {
  L, LU, U, RU, R, RD, D, LD, STOP, JUMP;
}

for(Direction d: Direction.values()) {
  this.drawPaoTong(g, d);
}

for (int i = 0; i < Direction.values().length; i++) {
  Direction.values()[i];
}

枚举随机遍历:Direction.values()[new Random().nextInt(Direction.values().length)];

上一篇:COM实现过程


下一篇:C#一些不太熟悉的类——扩展学习