Starting backwards from your stacktrace...
Stan Austin wrote:
This line ...
says that the main() method will call a method at line 82 of the TestClass.java file.... which leads to this line...
which says that the extractMin() method, that was called from main() method will do an operation at line 41 of the TestClass.java file... that triggers this...
This is an array out of bounds index.... specifically, the code is trying to access the element at index -1. And since
Java doesn't support negative indexes, it is clear why this is an error. Anyway, going to line 41 of the TestClass.java file, you get this...
... and ... from this line, it is quite clear where the issue is. There are two array dereferences, but one of them is clearly index zero. The other is dependent on the position variable... and...
If you print out the position variable, I will easily bet that the value of the position at this point is zero...
Henry