How to loop Java Enums Example

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


No comments:

Post a Comment

Confusion Matrix + Precision/Recall (Super Simple, With Examples)

  Confusion Matrix + Precision/Recall (Super Simple, With Examples) 1) Binary Classification Setup Binary classification means the model p...

Featured Posts