Why this code when write System.out.println(y);give this output and what is mean but when writ system.out.println(y.one) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this code when write System.out.println(y);give this output and what is mean but when writ system.out.println(y.one)

give the right code https://code.sololearn.com/cwQIjtJdtEA8/?ref=app

3rd Jul 2017, 12:55 AM
esraa ragab
2 Answers
0
the first is printing object reference or calling your toString method that you have over ridden in your class. the second is printing a field of y. which are you after?
3rd Jul 2017, 1:03 AM
Venkatesh Pitta
Venkatesh Pitta - avatar
0
tostring method ?lcan not understand what you mean can explain more
3rd Jul 2017, 1:21 AM
esraa ragab