This Java code demonstrates the range() method of EnumSet class, which creates an EnumSet that includes all of the values between the specified start and end values (inclusive).
import java.util.*; public class RangeMethod { public static void main(String[] args) { EnumSet < WEEKDAY > enum_set; enum_set = EnumSet.range(WEEKDAY.Tuesday, WEEKDAY.Saturday); System.out.println("EnumSet : " + enum_set); } } enum WEEKDAY { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };
EnumSet : [Tuesday, Wednesday, Thursday, Friday, Saturday]
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions