public
String toString()
Returns
the name of this enum constant, as contained in the declaration.
enum Day{ MON, TUE, WED, THU, FRI, SAT, SUN; public static void main(String args[]){ for(Day d1 : Day.values()){ System.out.println(d1.toString()); } } }
Output
MON TUE WED THU FRI SAT SUN
No comments:
Post a Comment