public class Array2Demo2_3 {

    public static void main(String[] args) {

        //定义初始化
int[][] arr = new int[3][];//定义高维数组
arr[0] = new int[2];//高位数组下定义低维数组
arr[1] = new int[3];
arr[2] = new int[4]; arr[0][0] = 1;//给低维数组初始化
arr[0][1] = 2;
arr[1][0] = 1;
arr[1][1] = 2;
arr[1][2] = 3;
arr[2][0] = 1;
arr[2][1] = 2;
arr[2][2] = 3;
arr[2][3] = 4; for(int i = 0;i<arr.length;i++) {
for(int j = 0;j<arr[i].length;j++) {
System.out.print(arr[i][j]);
}
System.out.println();
}
//-------------------------杨辉三角----------------------------
int row = 8;
int[][] arr1 = new int[row][row];
for(int i = 0;i<row;i++) {
for(int j = 0;j<=i;j++) {
if(j == 0||j == i) {
arr1[i][j] =1;
}else {
arr1[i][j] = arr1[i-1][j-1]+arr1[i-1][j];
}
}
} for(int i = 0;i<row;i++) {
for(int j = 0;j<=i;j++) {
System.out.print(arr1[i][j]+" ");
}
System.out.println();
}
} }

  

最新文章

  1. KTV项目 SQL数据库的应用 结合C#应用窗体
  2. HtmlAgilityPack使用
  3. [翻译]:SQL死锁-锁与事务级别
  4. 添加网页ico
  5. jquery获得option的值和对option进行操作 作者: 字体:[增加 减小] 类型:转载 时间:2013-12-13 我要评论
  6. c++ 对象内存布局详解
  7. CMD删除Mysql 服务
  8. 对XXX(数字)安全卫士实在是忍无可忍了,为什么一定要像日本鬼子强奸妇女一样强奸我们这些弱小者
  9. 一个load飙高的过程分析,非常有价值(转)
  10. android判断网络的类型
  11. Windows 上连接本地 Linux虚拟机上的 mysql 数据库
  12. .net 支付宝接口小小误区
  13. 安装并运行Hello World
  14. mac os使用迁移助手之后运行php报:dyld相关错误,错误排错流程分析
  15. Javascript 实现[网红] 时间轮盘
  16. Intel 8086_通用寄存器|段寄存器
  17. 一个简单例子理解C#的协变和逆变
  18. MFC修改窗口无标题和标题信息,修改执执行文件图标
  19. Delphi中使用OLE方法操作Excel
  20. jacoco生成覆盖率

热门文章

  1. i.mx6 Android5.1.1 系统属性
  2. 高并发系列之——MQ消息中间件Kafka
  3. jsp技术知识点
  4. [LeetCode]Generate Parentheses题解
  5. Spring_Spring与AOP_AspectJ基于XML的实现
  6. SQL语句的拼凑
  7. sql中,In和where的区别
  8. 在 Ubuntu上使用 MySQL
  9. FlatBox-WordPress Responsive Flat Design Theme
  10. VScode基础设置