package 包装类;
import java.util.*;
public class Test03 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println(“welcom! format is nian-yue-ri”);
System.out.print(“qing shu ru birthday:”);
String birth = s.next();
if(birth.charAt(4) == ‘-’ || birth.charAt(7) == ‘-’){
String[] birth1 = birth.split("-");
int[] array = new int[3];
for (int i = 0; i < birth1.length; i++) {
array[i] = Integer.parseInt(birth1[i]);
}
int week = Test03.print(Calendar.getInstance(), array[0], array[1], array[2]);
System.out.println(week - 1);
}
else {
System.out.println("format erro!");
}
}
public static int print(Calendar c,int year,int month,int day ){
c.set(Calendar.YEAR,year);
c.set(Calendar.MONTH,month-1);
c.set(Calendar.DAY_OF_MONTH,day);
return (c.get(Calendar.DAY_OF_WEEK));
}
}