0

Can you help me with my code?

Hello. 😃 I am learning OOP in Java and wrote a nice program (players in guilds and their managing), bit hit a tiny problem. I have a method, that should output "<PlayerName> has <Player's money>

quot; and printing name of of he player (object) doesn't work. The method uses "this" as Player's name. But instead of name of the object it outputs name of the class followed by "@" and a hexadecimal ID (e. g. Soldier@e29ba673d). I made an eaaier program with the same problem. It should output "Hi, I am Johny".

29th Mar 2018, 1:58 PM
Jan Ơtěch
Jan Ơtěch - avatar
3 Answers
29th Mar 2018, 2:10 PM
đŸ‡źđŸ‡· M N
29th Mar 2018, 1:58 PM
Jan Ơtěch
Jan Ơtěch - avatar
0
Thank you. So I have to add a Name attribute. Doesn't exist any function that returns name of the object?
29th Mar 2018, 2:56 PM
Jan Ơtěch
Jan Ơtěch - avatar