What does the System.out.println(<objectname>) print?... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What does the System.out.println(<objectname>) print?...

What result this code gives?... https://code.sololearn.com/c2qRx3x2AlKZ/?ref=app

21st Apr 2019, 8:51 AM
Paranoid
Paranoid - avatar
4 Answers
+ 6
you accidentally made copies of you question ,please remove this because it has no value: https://www.sololearn.com/Discuss/1768295/?ref=app edit : kool👍😊 Paranoid
21st Apr 2019, 11:09 AM
Daljeet Singh
Daljeet Singh - avatar
+ 2
"Program@xxxxxx" means that it's located in memory on place xxxxxx.
21st Apr 2019, 9:03 AM
Adam Priesnitz
Adam Priesnitz - avatar
+ 2
Done...
21st Apr 2019, 11:37 AM
Paranoid
Paranoid - avatar
+ 2
The syntax of the output is as follows :- ProjectName.ClassName@****** Here, ****** represents six characters(may be digits or alphabets) hashcodes. Hashcodes values will vary every time you run the program. Explaination ------ Example:- class Program { static void main (String[] args) { Program ob = new Program (); System.out.println(ob); } } In the above example, when you run the code the ob will by default call toString() function of class Objects (by default every class extends Object class). And toString() will print the output. I hope you'll better understand now . This questions has been asked in many Java interviews.
22nd Apr 2019, 9:41 AM
Laksheya
Laksheya - avatar