public class UsingEnums {
private UsingEnums(Weekdays testday) {
switch
(testday) {
case Saturday:
case Sunday:
System.out.println("It's the weekend!");
break;
case Wednesday:
System.out.println("It's Humpday!");
break;
case Friday:
System.out.println("TGIF!");
break;
default:
System.out.println("Backto work!");
}
}
public enum Weekdays {
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
};
public UsingEnums() {
Weekdays weekDays = null;
System.out.println(weekDays.Friday);
}
public static void main(String[] args) {
UsingEnums myUE = new UsingEnums();
UsingEnums myUE1 = new UsingEnums(Weekdays.Monday);
}
}
private UsingEnums(Weekdays testday) {
switch
(testday) {
case Saturday:
case Sunday:
System.out.println("It's the weekend!");
break;
case Wednesday:
System.out.println("It's Humpday!");
break;
case Friday:
System.out.println("TGIF!");
break;
default:
System.out.println("Backto work!");
}
}
public enum Weekdays {
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday
};
public UsingEnums() {
Weekdays weekDays = null;
System.out.println(weekDays.Friday);
}
public static void main(String[] args) {
UsingEnums myUE = new UsingEnums();
UsingEnums myUE1 = new UsingEnums(Weekdays.Monday);
}
}
No comments:
Post a Comment