getyear

public class GetYear {
public static void main(String[] args) {
String s = getYear(1996);
System.out.println(s);
}
public static String getYear(Integer year){
if(year<1900){
return "未知";
}
Integer start=1900;
String [] years=new String[]{
"鼠","牛","虎","兔",
"龙","蛇","马","羊",
"猴","鸡","狗","猪"
};
return years[(year-start)%years.length];
}
}

猜你喜欢

转载自www.cnblogs.com/YRSWBY2016/p/12021534.html