首页 > 编程语言 > 详细

多维数组(二维数组)

时间:2021-04-30 15:13:17      阅读:28      评论:0      收藏:0      [点我收藏+]
 1 package com.pingfan.array;
 2 
 3 public class ArrayDemo5 {
 4     public static void main(String[] args) {
 5         //[4][2]面向对象
 6         /*
 7             1,2    array[0]
 8             2,3    array[1]
 9             3,4    array[2]
10             4,5    array[3]
11          */
12         int[][] array = {{1,2},{2,3},{3,4},{4,5}};
13         for (int i = 0; i < array.length; i++) {
14             for (int j = 0; j < array[i].length; j++) {
15                 System.out.println(array[i][j]);
16             } 
17         }
18     }
19     //打印数组元素
20     public static void printArray(int[] arrays){
21         for (int i = 0; i < arrays.length; i++) {
22             System.out.println(arrays[i] + " ");
23         }
24     }
25 }

 

多维数组(二维数组)

原文:https://www.cnblogs.com/HeartlessHero/p/14721210.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!