Instantiate each object in an array - Java
Im 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.
cheers
No comments:
Post a Comment