package enums;

 

public enum DaysOfWeek {

    Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday;

}

 

 

 

 

 

package enums;

public class UsingEnums {

    public static void main(String[] args) {

        DaysOfWeek monday = DaysOfWeek.Monday;

        DaysOfWeek sunday = DaysOfWeek.Sunday;

    }

}

 

 

 

 

 

package enums;

 

public enum DaysOfWeek {

    Monday(true),Tuesday(true),Wednesday(true),Thursday(true),

        Friday(true),Saturday(false),Sunday(false);

 

    private DaysOfWeek(boolean weekday) {

        this.weekday = weekday;

    }

    private boolean weekday;

    public boolean isWeekday() {

        return weekday;

    }

}

 

 

 

 

 

package enums;

public class UsingEnums {

    public static void main(String[] args) {

        DaysOfWeek monday = DaysOfWeek.Monday;

        DaysOfWeek sunday = DaysOfWeek.Sunday;

        System.out.println("Monday is a weekday? :" +

           monday.isWeekday());

        System.out.println("Sunday is a weekday? :" +

           sunday.isWeekday());

    }

}