您的位置:首页 > 其它

1.8作业

2016-01-08 22:42 399 查看


public class WEI {

public static void main(String[] args) {
// 创建一维数组arr[],并将其遍历输出。
int arr[] = new int[] { 54, 65, 89, 789, 231 };

// 用foreach语句

for (int f : arr) {
System.out.println("输出为:" + f);
}

int min = arr[0];

for (int a = 0; a < arr.length; a++) {
if (min < arr[a]) {
min = arr[a];
}

}

System.out.println("最大的数为" + min);
}

}






public class WEI {

public static void main(String[] args) {
//创建一维数组arr[],并将其遍历输出。
int arr []=new int[]{ 54,65,89,789,231};

//用foreach语句

for(int f : arr )
{
System.out.println("输出为:"+f);
}

}

}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: