public enum Days {
SUNDAY,
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY;
public enum WeekDays{
MONDAY,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
}
public enum WeekEnds{
SATURDAY,
SUNDAY;
}
}
public class InnerEnumTestClass<E extends Enum<E>> {
public E enumtype;
/**
* @param enumtype
*/
public InnerEnumTestClass(E enumtype) {
super();
this.enumtype = enumtype;
}
/**
* @param args
*/
public static void main(String[] args) {
InnerEnumTestClass<Days> testObj =
new InnerEnumTestClass<Days>(Days.WeekDays.MONDAY);
// I get the following compiler error.
//The constructor InnerEnumTestClass<Days>(Days.WeekDays) is undefined
}
}
As you see the Class InnerEnumTestClass accepts only type but I need the constructor to accept Days, Days.WeekDays and Days.Weekends.
How to establish this ?