本帖最后由 manutdsodagreen 于 2010-03-08 02:22:11 编辑

解决方案 »

  1.   

    new objectArrayEx().new Date(1,2,3)看看行不!
      

  2.   

    你的类属于内部非静态类,不能直接new出来
    如果是
      static class Date {
        int a, b, c;    Date(int x, int y, int z) {
          a = x;
          b = y;
          c = z;
        }
      }那么在objetArrayEx的静态方法里面是可以直接new的。
      

  3.   

    不知道你为什么要这么做,把Date单独定义为一个类(也就是不要定义在objectArrayEx里面),就可以了。
    除非你是想试验有关内部类的问题。
      

  4.   

    呃,仔细一看是个内部类喔,呵呵
    放到外边儿就好了public class objectArrayEx {
        public static void main(String[]args){
            int a[]={3,9,8};//你要这个数组干吗,没用到呀
           Date days[];
           days=new Date[3];
          days[0]=new Date (1,2,3); // this line is wrong, but I cannot figure out how to fix it....can anybody teach me? thank you!!!
              for(int i=0;i<days.length;i++)
           {System.out.println(days[i].a); }    }
    }
    class Date{
            int a,b,c;
            public Date(int x,int y,int z)
                {
                a=x;
                b=y;
                c=z;
            }
    }
      

  5.   

    不能直接New出来的,因为和你的main函数中同一个类中,main函数是static的
    所以得加句
    objectArrayEx  oa = new objectArrayEx();
    days[0]=oa.new Date (1,2,3);