+ 1

How to avoid printing Memory address of variables in Java?

I can't understand why console printing Memory address instead of carList. https://code.sololearn.com/ca2179a13a10

23rd Apr 2021, 3:22 AM
Ron
2 Answers
+ 1
Ok, thanks for 怌ļ¼Øļ¼”ļ¼°ļ¼°ļ¼¹ ļ¼“ļ¼Æ ļ¼Øļ¼„ļ¼¬ļ¼°ć€ and Nikhil. Now I understood.
23rd Apr 2021, 3:44 AM
Ron
+ 1
You can also override the toString() method since it is invoked whenever you print an object. https://code.sololearn.com/caXPs3RVc8RY/?ref=app
23rd Apr 2021, 4:19 AM
Soumik
Soumik - avatar