I have created an array of objects but on printing it will give me reference values of objects rather then variable of objects? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I have created an array of objects but on printing it will give me reference values of objects rather then variable of objects?

21st Feb 2020, 5:31 PM
Muhammad Bilal
Muhammad Bilal - avatar
5 Answers
+ 3
Thanks alot
21st Feb 2020, 5:58 PM
Muhammad Bilal
Muhammad Bilal - avatar
+ 2
You have to override the toString() method and then call the toString() on the student object.
21st Feb 2020, 6:03 PM
Avinesh
Avinesh - avatar
+ 1
Share your code please.
21st Feb 2020, 5:39 PM
Avinesh
Avinesh - avatar
21st Feb 2020, 5:54 PM
Muhammad Bilal
Muhammad Bilal - avatar
+ 1
This is how you should do it in order to print objects of a class. https://code.sololearn.com/cTAlj0Gk1Gb7/?ref=app
21st Feb 2020, 6:09 PM
Avinesh
Avinesh - avatar