提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用日历显示星期几
import java.util.Calendar;/*nowjava.com 提 供*/ public class Main { public static void main(String[] args) { //create Calendar instance Calendar now = Calendar.getInstance(); System.out.println("Current date : " + (now.get(Calendar.MONTH) + 1) + "-" + now.get(Calendar.DATE) + "-" + now.get(Calendar.YEAR)); //create an array of days String[] strDays = new String[]{ "Sunday", "Monday", /* 时代Java - nowjava.com */ "Tuesday", "Wednesday", "Thusday", "Friday", "Saturday" };