Given: Which statement will iterate through Direction?
A.
for (Direction d : Direction.asArray()){ // }
B.
for (Direction d : Direction.values()){ // }
C.
for (Direction d : Direction.asList()){ // }
D.
for (Direction d : Direction.iterator()){ // }
b
public enum Direction{
East(1),West(2),South(3),North(4);
int value=0;
Direction(int value){
this.value = value;
}
}
public class Tester{
public static void main(String[] args){
for(Direction d: Direction.values()){
System.out.println(d.value);
}
}
}