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!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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 Réponse
+ 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