import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class Main {
public static void main
(String args
[]) { List<Date> dates = new ArrayList<Date>();
int year = 0, month = 0;
System.
out.
print("年を入力してください:"); try {
year
= Integer.
valueOf(br.
readLine()); // no good? //calendar.set(Calendar.YEAR, Integer.valueOf(br.readLine())); // good?
e.printStackTrace();
e.printStackTrace();
}
System.
out.
print("月を入力してください:"); try {
month
= Integer.
valueOf(br.
readLine()) - 1; // no good? //calendar.set(Calendar.MONTH, Integer.valueOf(br.readLine()) - 1); // good?
e.printStackTrace();
e.printStackTrace();
}
calendar.set(year, month, 1); // no good?
int endMonth
= calendar.
getActualMaximum(Calendar.
DAY_OF_MONTH); // 現在設定されている年月の最終日を取得 for (int day = 1; day <= endMonth; day++) {
calendar.set(year, month, day);
//calendar.set(Calendar.DAY_OF_MONTH, day); // good?
dates.add(calendar.getTime());
}
for (Date date
: dates
) { System.
out.
println(sdf.
format(date
)); }
}
}
aW1wb3J0IGphdmEuaW8uQnVmZmVyZWRSZWFkZXI7CmltcG9ydCBqYXZhLmlvLklPRXhjZXB0aW9uOwppbXBvcnQgamF2YS5pby5JbnB1dFN0cmVhbVJlYWRlcjsKaW1wb3J0IGphdmEudGV4dC5TaW1wbGVEYXRlRm9ybWF0OwppbXBvcnQgamF2YS51dGlsLkFycmF5TGlzdDsKaW1wb3J0IGphdmEudXRpbC5DYWxlbmRhcjsKaW1wb3J0IGphdmEudXRpbC5EYXRlOwppbXBvcnQgamF2YS51dGlsLkxpc3Q7CgpwdWJsaWMgY2xhc3MgTWFpbiB7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmcgYXJnc1tdKSB7CgkJTGlzdDxEYXRlPiBkYXRlcyA9IG5ldyBBcnJheUxpc3Q8RGF0ZT4oKTsKCQlDYWxlbmRhciBjYWxlbmRhciA9IENhbGVuZGFyLmdldEluc3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