arraylist可以动态的添加成员,数组在new了之后大小的固定了。

解决方案 »

  1.   

    public class ArrayList:
    Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. (This class is roughly equivalent to Vector, except that it is unsynchronized.)public class Arrays:This class contains various methods for manipulating arrays (such as sorting and searching). This class also contains a static factory that allows arrays to be viewed as lists. 
      

  2.   

    ArrayList是实现List接口的可变数组,允许包括null在内的所有对象
    除了提供List接口的实现之外还提供了一些方法来控制数组的大小,和Vector类似但它不是同步的
      

  3.   

    good good study ,day day up
      

  4.   

    同步是Java线程的问题,
    比如一个数组,一个线程正在挨个儿改变数组中的元素;另一个数组要得到数组中的每一个元素。
    这样就可能出现问题:第二个线程得到的元素可能一半是原来的,一半是改变过的。这就会出现不可预知的错误。同步就是为了防止这种错误出现的。
    如果一个对象使用了同步,那么在同一时间内,只用一个线程可以访问这个对象。这样就可以防止那类错误的发生了。同步还可以用于线程之间的通讯,这就是另外的问题了。