Bummer! You have been redirected as the page you requested could not be found.

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 Objects (Retired) Meet Objects Privacy and Methods

Suleyman Orazgulyyev
PLUS
Suleyman Orazgulyyev
Courses Plus Student 5,798 Points

This pointer in C++ and Java

Hello everyone!

My question is very short, as I know in C++ and we use -> whenever we talk about pointers, and we also use this-> . So in Java it would be this . ? Is there a -> operator in Java?

2 Answers

Seth Kroger
Seth Kroger
56,414 Points

No, there's no such thing as pointers in Java. In Java all objects are reference types, roughly like declaring a object variable with & in C++.

In Java the -> operator is used to declare lambda functions.

Suleyman Orazgulyyev
Suleyman Orazgulyyev
Courses Plus Student 5,798 Points

That makes me fall in love with Java :) thank you for your answer and your time :)