定义没有声明呀
int[] x;         定义
x=new int[10];   初始化

解决方案 »

  1.   

    to define an array,you can use:
    int[] a1;
    or int a1[];
    All that you have at this point is a reference to an aray,and there's been no space allocated  for the array.
    To create storage for the array ,you must write an initialization expression.
      

  2.   

    无论用何种方式定义数组,都不能指定其长度,这是指不能出现这种情况:int s[10];
    而int s[]=new s[10]是正确的!
      

  3.   

    我定义一下名为x的数组
    System.out.println("The array length is "+x.length);
    用上面语句可以打印出长度 
    但如何打印出二维数组的长度呢
    比如下面的语句
    int xx[][]=new int [3][2];
    System.out.println(xx.length); \\这句输出3 
    我相让他输出2有这个可能吗?
    如果可以的话该如何写?
      

  4.   

    int x[]=new int [10]; 是没错的,因为该语句定义并初始化了
    可以看成如下2步
    int[] x;         定义
    x=new int[10];   初始化
    换本书吧.....
      

  5.   

    数组不能指定长度指的是int x[]  在定义的时候不能指定
      在它初始化的时候就能指定了  x=new int [20];