题解 | 数组遍历
import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String line = scan.nextLine(); String[] numbers = line.split(" "); List<Integer> list = new ArrayList<>(); for (String sn : numbers) { list.add(Integer.valueOf(sn)); } int max = 0,min = 114514; for (int n : list) { if (n > max) max = n; if (n < min) min = n; } //write your code here...... System.out.println(max+" "+min); } }