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 Organizing Data Interfaces

Courtney Wilson
Courtney Wilson
8,031 Points

What does he mean @ 9:43?

I have two (related) questions. In regards to

Treet other = (Treet) obj; ... if (dateCmp == 0) { return mDescription.compareTo(other.mDescription); }

Craig explains how we are able to access the private variable mDescription of the "other" instance. I (think) I understand how it works but he says something that throws me off. Can someone explains what he means by this:

9:34 It's private to this class here but we're in the class, so we are able to see it. 9:43 Any class can see private variables of other classes

I thought only the class in which a private variable is declared can see its private variables. In this case, since "other" is an instance of the Treet class, it's private variables should be accessible because we are in the same class. But in any other classes, we wouldn't be able to access them, correct?