+ 1
How to display all values of enum in java? Is that possible using loop?
5 ответов
+ 2
enum values method return an array of all its values(enum.values())
u can store it in an array and iterate , or iterate enum.values() directly using range based for loop
+ 2
Thank you, I get it
I use the enum.values()[i]
https://code.sololearn.com/cFZ6oXBnWBfJ/?ref=app
+ 1
u can get all enum values as array(values() method),then iterate the array
0
How it is implemented?
0
import java.util.Arrays;
..
RANK[] ar = RANK.values();
System.out.println(Arrays.toString(ar) );