for(j=0; j<j+1; j++) j<j+1??

解决方案 »

  1.   

    要打印
    0
    1 2
    3 4 5
    6 7 8 9
    是这个形状吗?
    如上所述,所有的j<j+1,应该为 就j<=i;
      

  2.   

    class Twoarray
    {public static void main(String[] args)
    应该是public  class Twoarray
    {public static void main(String args[])吧~~
      

  3.   

    ArrayIndexOutOfBoundsException已经告诉你哪儿错了
      

  4.   


    j<j+1 应该为j<i+1;没问题
    还要指出楼上说的(String[] args)

    String args[]
    一样用
      

  5.   

    感觉你的这一层循环for(j=0;j<j+1;j++)有问题
    你应该改成:
    for(i=0;i<4;i++) 
      for(j=0;j<=i;j++)
      

  6.   

    j<j+1永远成立,那这个循环是死的
    并且会下标越界,下标是从1而不是从0开始
      for(i=1;i<=4;i++)
         for(j=1;j<=i;j++){
            nums[i][j]=k;
            k++;
         }
    ......
      

  7.   

    nums[0] = new int[1];
     nums[1] = new int[2]; 
     nums[2] = new int[3];
     nums[3] = new int[4];
    =======>
    nums[0]=new int[0];
    nums[0]=new int[1];
    nums[0]=new int[2];
    nums[0]=new int[3];