回覆列表
  • 1 # 畢耀輝哈

    LinkedList llist=new LinkedList();llist.add("..");...String[] str=new String[llist.size()];llist.toArray(str);這樣Object[]陣列就轉到了String[]陣列了,你可以去參考toArray()方法原型:public synchronized <T> T[] toArray(T[] a) { if (a.length < elementCount) a = (T[])java.lang.reflect.Array.newInstance( a.getClass().getComponentType(), elementCount); System.arraycopy(elementData, 0, a, 0, elementCount); if (a.length > elementCount) a[elementCount] = null; return a; }

  • 中秋節和大豐收的關聯?
  • 尿毒症晚期能活多久?