2013年12月13日星期五

Why is this program array.length () is not successful ?

If that, please help me doubts where noted . Thank you.

import java.util.*;

public class Test
{
public static void main(String [] args)
{
         int a = 20;
         Integer b = new Integer(20);        
         Integer i =10;
         
         List<Integer> list = new ArrayList<Integer>();
         list.add(i);
         list.add(b);
         list.add(new Integer(30));
         
         System.out.println(list);
         
         Integer[] array = new Integer[list.size()];
         list.toArray(array);
         for(Integer e: array)
         {
         System.out.println(e);
         }
                
         int brray[] = new int[array.length()]; //array是个数组,为什么array.length()不成功呢?        
           
}
}

------ Solution ------------------------------------- -------
array.length not array.length ().
------ Solution ------------------- -------------------------
array length method does not have the length property
------ Solution - ------------------------------------------
length is an attribute , not a The method can not be used ( ) .
array length about the landlord may have a look this post, very well.
http://bbs.csdn.net/topics/110121291

没有评论:

发表评论