Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Data Structures - Retired Getting There Class Review

Antony Aloysius
PLUS
Antony Aloysius
Courses Plus Student 1,282 Points

System.out.printf("%s \n",treet); com.teamtreehouse.Treet@6d06d69c How the o/p is coming as above?

Not able to understand this when we do System.out.printf("%s \n",treet) how we are getting the o/p as -> com.teamtreehouse.Treet@6d06d69c

2 Answers

Robert Stefanic
Robert Stefanic
35,170 Points

Hi,

It's because you haven't overridden the "ToString()" method that your Treet class has inherited from the Object class.

He explains what this is, and how to override this inherited method in a later video.

The current string that it is being printed, without overridding the ToString method (com.teamtreehouse.Treet@6d06d69c), is just saying that there is an instance of your com.teamtreehouse.Treet object located at (hence the '@' symbol) this location in memory (6d06d69c is a memory address).

Antony Aloysius
PLUS
Antony Aloysius
Courses Plus Student 1,282 Points

Thanks.. saw the video in next session. understood the concept.