Searching...
Saturday, 2 November 2013

How to loop Java Enums Example

09:28

Example

package com.pretech;
public class EnumLoopExample {
	public static void main(String[] args) {
		for (Week weekdays : Week.values()) {
			System.out.println(weekdays);
		}
	}
}
enum Week {
	MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY,
}

Output



MONDAY
TUESDAY
WEDNESDAY
THURSDAY
FRIDAY
SATURDAY
SUNDAY


0 comments: