题解 | #数组遍历#
数组遍历
https://www.nowcoder.com/practice/0f8219cb6f6e4e99a1bb0e868e51d60a
import java.util.Scanner; import java.util.Arrays; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int[] a = new int[6]; for(int i = 0; i < 6; ++i){ a[i] = in.nextInt(); } Arrays.sort(a); System.out.println(a[5] + " " + a[0]); } }