public static voidmain(String[] args)throws Exception {// Are appropriate arguments given?if(args.length !=3) {
System.err.println("usage: FindDay year month day");
System.exit(1);}// Parse year, month, dayint year = Integer.parseInt(args[0]);int month = Integer.parseInt(args[1]) -1;int monthDay = Integer.parseInt(args[2]);// Set the calendar and calculate the day namevar d =newGregorianCalendar(year, month, monthDay);
String dn =weekDayName(d.get(Calendar.DAY_OF_WEEK));// Print the day name
System.out.println(dn);}