课程
/后端开发
/Java
/Java入门第一季(IDEA工具)升级版
运行结果不对啊
2018-08-04
源自:Java入门第一季(IDEA工具)升级版 6-8
正在回答
for(int score;scores) 你的这句代码应该是for(int score:scores)
for
(
int
score;scores)
import java.util.Arrays;
public class HelloWorld {
public static void main(String[] args) {
// 定义一个整型数组,保存成绩信息
int[] scores = { 89, 72, 64, 58, 93 };
// 对Arrays类对数组进行排序
Arrays.sort(scores);
// 使用foreach遍历输出数组中的元素
for ( int score : scores ) {
System.out.println(score);
}
import java.util.Arrays; public class HelloWorld { public static void main(String[] args) { int[] scores={89,72,58,93}; Arrays.sort(scores); for(int score;scores) { System.out.println(score); } } }
举报
0基础萌新入门第一课,从Java环境搭建、工具使用、基础语法开始
8 回答package com.HelloWorld; import java.util.Arrays; public class HelloWorld { //完成 main 方法 public static void main(String[] args) { HelloWorld hello=new HelloWorld(); hello.sort(89 , -23 , 64 , 91 , 119
2 回答public class HelloWorld{ public static void main(String[] args) { System.out.println(hobby); } }
4 回答public class HelloWorld!{ public static void main(String[] args) { System.out.println("Hello Imooc"); } }
1 回答public class HelloWorld! { public static void main(String[] args) { System.out.println("hello imooc"); } }
3 回答public class HelloWorld { public static void main(String[] args) { // 定义一个整型数组,并赋初值 int[] nums = new int[] { 61, 23, 4, 74, 13, 148, 20 }; int max = nums[0]; // 假定最大值为数组中的第一个元素 int min = nums[0]; // 假定最小值为数组中的第一个元素 dou