本帖最后由 joechen 于 2013-8-21 11:06 编辑
我记得可以省略else的
class Demo2
{
public static void main(String[] args)
{
int[]shuzu=new int[]{5,8,6,44,5,4};
dayin(shuzu);
dayin(shuzu);
}
public static void dayin(int[] shuzu)
{
for (int x=0;x<shuzu.length ;x++ )
{
if(x!=shuzu.length-1)
System.out.print(shuzu[x]+",");
else //此处的else可以省略吗?
System.out.println(shuzu[x]);
}
}
}
|