r/learnjava • • Oct 09 '22

Help needed!!

PROBLEM SOLVED thanks to

NautiHooker

https://www.baeldung.com/java-tostring

I'm trying to complete a project for class and running out of time. I need to create a dealership inventory program but I'm having issues. The main one is that the arraylist does not seem to be working. Please if anyone can look it over and help it would be greatly appreciated!

https://pastebin.com/wXjuGP45

1 Upvotes

6 comments sorted by

View all comments

1

u/NautiHooker Oct 09 '22

Please give us more details on your issue.

0

u/[deleted] Oct 09 '22

When I try to have it list the array I shows something odd like this "BigChadsAutos@58372a00" and it also prints the same thing. I'm not sure if I messed up with the array. And since the array doesn't seem to be working the methods to remove vehicles and update vehicles does not work either. I'm not sure exactly what is wrong, and I'm not getting error messages.

2

u/NautiHooker Oct 09 '22

If BigChadsAutos does not implement a toString method, then it will show such a text with the class name and hashcode instead.

You can define your own toString method to decide what needs to be shown.

https://www.baeldung.com/java-tostring

2

u/[deleted] Oct 10 '22

THANK YOU SO MUCH!!! That solved all my issues, I really appreciate your help!