오랜만에 Date 클래스를 사용해 보았다. 그런데 SimpleDateFormat을 까먹어서 다른 풀이를 참고했다. 복습에 도움을 받았다.
import java.text.SimpleDateFormat;
import java.util.Date;
public class bj10699 {
public static void main(String[] args) {
Date date = new Date();
/* int year = 1900 + date.getYear();
int month = 1 + date.getMonth();
int day = date.getDate();
System.out.println(year + "-" + month + "-" + day);*/
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
System.out.println(simpleDateFormat.format(date));
}
}