package com.di.ex04;
import java.util.Calendar;
public abstract class Day {
public abstract String dayInfo();
public static Day getInstance() {
Calendar calendar = Calendar.getInstance();
int day = calendar.get(Calendar.DAY_OF_WEEK); // DAY_OF_WEEK : 날짜에 대한 1~7 숫자 반환.
switch(day) {
case 1:
return new Sunday();
case 2:
return new Monday();
case 3:
return new Tuesday();
case 4:
return new Wednesday();
case 5:
return new Thursday();
case 6:
return new Friday();
default:
return new Saturday();
}
}
}