Question: Assume you have a programmer-defined class named Person. Assume this class includes a name instance variable, initialized by the constructors name parameter. Suppose a driver
Assume you have a programmer-defined class named Person. Assume this class includes a name instance variable, initialized by the constructor’s name parameter. Suppose a driver fills a people array with Person objects. Then the driver goes back through the array and uses System.out.println(people[i]); to print the people’s names. Unfortunately, what the driver prints is Something like this:
Person@65ae6ba4
Person@512ddf17
Person@2c13da15
Person@77556fd
What is the problem and how can you fix it?
Step by Step Solution
3.47 Rating (154 Votes )
There are 3 Steps involved in it
The problem you are seeing is that Java is printing the memory location of each Person object in the ... View full answer
Get step-by-step solutions from verified subject matter experts
