How to create an array that extends itself. I don't want to use the classes like ArrayList and Vector etc to do this. Instead i need to generate an array that extends it's size upon adding elements to it. This is question by my teacher.
Say for example, i want an int[] which extends it's size.
For instance, the user want to enter the student IDs into an array. The array has no fixed size since there are no fixed no. of students in this case. When the user says he wants one more, the array's size should be incremented by one.
Any answer is appreciated.
ArrayList? That's exactly what collections are made for. By discarding those tools, you're bound to re-invent the wheel (usually badly).ArrayListas an exercise. That would make sense, but keep in mind that that's for learning only and there's usually no other reason to do that.