Can we use for loop with enum in order to traverse constants? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Can we use for loop with enum in order to traverse constants?

14th Aug 2016, 5:25 AM
Neha Bhatt
2 Antworten
0
try this: enum Animals { TIGER, CAT, LION } public class Test { for (Animals a : Animals.values (){ System.out.println (a); } }
14th Aug 2016, 7:41 PM
Tiger
Tiger - avatar
0
this code won't work...what is Animals.value?
11th Nov 2016, 8:09 PM
tunde