I'm working on a linked list bit of code, with the following test method:
public class HeapTest {
public static void main(String[] args)
{
Heap MainHeap = new Heap();
int Value, i;
int Array[] = {100, 36, 19, 1, 25, 3, 17, 7, 2};
for (i = 0; i < 10; i++)
{
Value = Array;
MainHeap.insert(Value);
}
Heap.printstart();
}
}The list bits aren't the problem, as they've already been tested. When I ran the code making it randomize 10 variables for Value and inserting them, it worked fine. However, when I created the Array and changed it to cycle through the values and insert them, it gives me an 'Array Index Out Of Bounds' exception, but only when it assigns an Array entry to Value. When I tested it to print with the same For Loop, it works fine.
Can anybody see what's wrong here?