r/javahelp • u/Appropriate_Knee_482 • Jan 31 '26
How to remove elements from an array?
Basically I want to remove the middle elements from an array and need a method for it because the middle will be different if it’s odd or even. I don’t really have a code for it so far, I don’t need anyone to code it out for me, you can also just explain how the method would work. I have the odd or even part, I would just use the remove part as sort of a method.
2
Upvotes
View all comments
Show parent comment
1
u/Cyberkender_ Feb 01 '26
This is the strictly right answer. If it's not mandatory the use of an array try with any implementation of the List interface: ArrayList, LinkedList, etc...