Type mismatch: cannot convert from void to int[]
packagetest;importjava.util.Arrays;importjava.util.Scanner;publicclassMaxAndMin{publi...
package test;
import java.util.Arrays;
import java.util.Scanner;
public class MaxAndMin {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int[] arr = new int[10];
for(int i=0;i<arr.length;i++){
int next = s.nextInt();
arr[i] = next;
}
int[] after = Arrays.sort(arr);
System.out.println("Min:"+after[0]+"Max"+after[arr.length-1]);
}
}
怎么解决啊? 展开
import java.util.Arrays;
import java.util.Scanner;
public class MaxAndMin {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int[] arr = new int[10];
for(int i=0;i<arr.length;i++){
int next = s.nextInt();
arr[i] = next;
}
int[] after = Arrays.sort(arr);
System.out.println("Min:"+after[0]+"Max"+after[arr.length-1]);
}
}
怎么解决啊? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询