0

I have three classes: Prog(main one which contains whole program), Account ,Client.

Last two looks like this:

class Account{

private 
    Client person;  

 Account(Client tempClient){

    person=tempClient;
 }

}

class Client{

  private 
      String firstName;
      String lastName;
      String address;
      long pin;

  Client(String clientFirstName, String clientLastName, String clientAddress, long clientPin){

    firstName=clientFirstName;
    lastName=clientLastName;
    address=clientAddress;
    pin=clientPin;
  }
}

In Prog class I create ArrayList of Accounts, and my problem is when I create them, I can't print it in proper way, my output looks like this:

[Account@5cad8086]
[Account@5cad8086]

When I print I simply use System.out.println(list), I know that probably I should implement my own toString method but where? In Account or Client class? Can you tell me how to fix this problem in a good way? Thanks.

NeviJ
  • 81
  • 1
  • 9

0 Answers0