赞
踩
public static void main(String[] args) { int[][] matrix = {{0, 30}, {15, 20}, {5, 10}, {-10, 20}}; //排序 Arrays.sort(matrix, (a, b) -> a[0] - b[0]); //打印结果 for (int[] arr : matrix) { for (int a : arr) { System.out.print(a + " "); } System.out.println(); } /* -10 20 0 30 5 10 15 20 */ }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。