Help Needed.. Java Beginner
It's about ArrayList
In the documentation it says that the set and remove methods both return an object then how come we don't need to save the reference of it anywhere ?
Code:
public java.lang.Object remove(int);
public java.lang.Object set(int, java.lang.Object);
here are the two possibilities..
Saving the refernece of the returned Objects
Code:
Team t3 = players.set(1,new Team("Rooney",12000,2));
Team t4 = players.remove(2);
It also works the other way around
Code:
players.set(1,new Team("Rooney",12000,2));
players.remove(2);
How ?