#Java question help
1 messages · Page 1 of 1 (latest)
not quite sure i get what ur asking for. could u provide some context and elaborate on the question? 🙂
He's asking for an ADT that mimics an array probably
So i am currently studying, and one question might be an adt array, the adt array uses inheritance so extends, it also has a copy constructor
i guess i didnt word it well enough
all i asked for was an example, but dont worry.
Can you give an example of its use?
public abstract class ArrayADT {
protected int size;
protected int[] elements;
public abstract void insert(int index, int value);
public abstract int get(int index);
}
abstraction layer for your array where you can define rules
Sure, so you're now asking what kind of class would extend this abstract ArrayADT?
You could make a SortedArray, or a CircularArray for example.
SortedArray always keeps it's elements in sorted order. Circular array could take a index beyond the length of the internal int[] element size.
