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 Sneak Peak: Method References

2min 26 seconds: what is the "name" instructor is referring to when saying " We used the name."

at 2min 26seconds of the video, instructor says: creates a new anonymous class. It’s typed. We used the name. Put the override with the method name. Defined the method. Put in there return type.

what is the "name" that instructor is referring to?

1 Answer

Steven Parker
Steven Parker
231,198 Points

The name being referred to is "compare". Because it has this name, I wouldn't consider this function to be truly anonymous, though it cannot be accessed by name elsewhere.

If you compare this to the other examples, you'll notice none of them have a name at all.