you are printing the objects not the values of your member variables. so you are getting such results.
try to get the object from your array and try using the getter methods to get your desired output.
You where well on your way but you need to override the toString in person. Because the Object's implementation of it just return the classname + @ + memorylocation in hex.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
The use of the toString() method is a common way to print the values of an Object. It's the reason behind the existence of the method. It is sufficient for simple printing/debugging but when it gets complexer you should separate data and presentation. In your case you could replace the the for loop and use the enhanced for loop instead. Also the System.out.println() method automatically uses the toString() method is the parameter is an Object reference (i.e. not a primitive) and the value is not null. So the toString() is unnecessary.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
Gift giving made easy with the permaculture playing cards