提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
创建参差不齐的数组
/* nowjava - 时 代 Java 提供 */ public class Main { public static void main(String[] args) { int ragged[][] = new int[5][]; for (int i = 0; i < 5; i++) { ragged[i] = new int[i + 1]; } for (int i = 0; i < 5; i++) { for (int j = 0; j < ragged[i].length; j++) { ragged[i][j] = (int) (10 * Math.random()); } } System.out.println("type:" + ragged + " " + ragged.length); for (int i = 0