从对象数组中删除对象

时间:2015-10-25 10:23:22

标签: java

有没有办法做到这一点:

Player[] player = new Player[numOfPlayers];
for(int i=0; i < numOfPlayers; i++){
    player[i] =  new Player("Player"+i, 0); 
}
//becomes like this right? 
player[0].name='a';
player[1].name='b'
player[2].name='c'
player[3].name='t'
player[i].name='baz'

如何删除说player[2]以便新的对象数组变为:

player[0].name='a';
player[1].name='c'
player[2].name='t'
player[i].name='baz'

0 个答案:

没有答案