When an object is passed to System.out.println as an argument it prints some hashcode, what does this hashcode represent? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

When an object is passed to System.out.println as an argument it prints some hashcode, what does this hashcode represent?

6th Jan 2018, 5:38 PM
Dhvani
Dhvani - avatar
1 Answer
+ 6
package.class@adress in memory of that object. If you want to print something different for your object you need to override toString() method in class which object belongs
6th Jan 2018, 5:48 PM
Vukan
Vukan - avatar