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

1 Expert Approved Answer
Step: 1 Unlock

The problem you are seeing is that Java is printing the memory location of each Person object in the ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction To Programming With Java A Problem Solving Approach Questions!