记得解答代码之后的问题哦
class ArrayDemo
{
public static void main(String[]args){
String week =getweek[num];
System.out.println(week)
}
}
public static String getweek(int num){
if ( num <0 || num >7){
return "错误数据";
}
String[]weeks={" ","星期一","星期二","星期三","星期四","星期五","星期六","星期日"};
return weeks[num]
}
}
因查表法来源于进制的相互转换,及为每个角标对应不用的数据, 那么怎么简单去理解之前的进制转换问题,在笔记总结的Day5 后半部分、要简单明了哦。
|
|