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)];