I'm not getting any errors from the following code but my toString
is returning null for the instance.
Shoe shoe[] = new Shoe[10];
shoe[0] = new Shoe();
shoe[0].setPosition(12, 34);
If I instantiate an object normally and call its setPosition
the toString
returns the correct position. But when trying to do this through the array it returns null.
There is nothing wrong with your code. Based on your comments there is likely lsome interplay between setPosition() and toString(). You should revisit that logic.
As per the code you've outlined in the description, it is good Java code.