可能重複:
How do I remove objects from an Array in java?
Removing an element from an Array (Java)如何從java中的數組中刪除元素,即使我們必須遍歷數組或者我們可以直接執行它?
listOfNames = new String [] {"1","2","3","4"}; //
String [] l = new String [listOfNames.length-1];
for(int i=0; i<listOfNames.length-1; i++) //removing the first element
l[i] = listOfNames[i+1];
//可以這樣工作,有沒有更好的辦法?在這種情況下從第一個數組中刪除某些元素。
Java?..........請使用一個簡短的重要標題並在文中陳述實際問題。 –
如果這不是您需要使用數組的功課,請查看[Collections](http://download.oracle.com/javase/6/docs/api/java/util/Collections.html),特別是[Lists](http://download.oracle.com/javase/6/docs/api/java/util/List.html) – Jacob
http://stackoverflow.com/questions/112503/how-do-i-remove -object-from-an-array-in-java – Jacob