package learning.test; public class myenum1 { public enum week{Sundau,Monday,Tuesday} public enum Month{Sundau,Monday,Tuesday} public static void main(String[] args){ week ww=week.Monday; switch (ww){ // 若switch 對象型態為 week case Monday: // 則case只能是week 中定義的值, 也不能寫成week.Monday System.out.println("Monday"); break; case Tuesday: System.out.println("Tuesday"); break; default: break; } if(week.Monday.toString()=="Monday"){ } } }
沒有留言:
張貼留言