0
How do I create a method that adds/removes elements (that are objects) into/out of an existing array?
I wish to create two methods in a custom class. One that adds and one that removes elements (that are objects) dynamically into/out of an existing array. Your help would be much appreciated.
3 Answers
0
Use ArrayList for dynamic arrays.
They have an add() and a remove() method which meet your needs.
0
Avinesh thank you for your swift response. Could you please give me an example if it isn't too much to ask?
0
Let me know if you understand.
https://code.sololearn.com/cMs8jUDVkb5l/?ref=app