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.

14th Mar 2020, 7:41 AM
Jay
3 Answers
0
Use ArrayList for dynamic arrays. They have an add() and a remove() method which meet your needs.
14th Mar 2020, 7:46 AM
Avinesh
Avinesh - avatar
0
Avinesh thank you for your swift response. Could you please give me an example if it isn't too much to ask?
14th Mar 2020, 7:53 AM
Jay
0
14th Mar 2020, 8:04 AM
Avinesh
Avinesh - avatar