Hi guys and gals,
I'm quite new to Java, and am presently muddling my way through an instruction course. I have got to dealing with custom Objects and using these in arrays. As a little play, I decided to generate a few little snippets of code that generate a "Planet" object with some properties and randomly seeds these amongst an x/y grid. That was the plan anyway!
What is actually happening is that the creation code is correctly generating the planet information, but when I pull it back it is not displaying a String associated with the relevant item in the array, but instead is returning the last String associated witht the last object in the array. I'm wondering if I have messed something up with the way that I have linked through, but I have been using "getters" and "setters" to modify the instance variables associated with the "planet" object, and so it should not have been possible to "overwrite" the instance variables, as they were set to private.
I have zipped the files used - the Planet.java file contains the information relating to the "Planet" object, whilst the Universe.java contains the main() class. The TextIO file is just something I'm using for displaying to the standard output screen, rather than use the inbuilt functions in Java.
Any help is greatly apreciated - I've lost a day on it as I've rewritten the code to try to get rid of this "feature", but it still exists.