Skip to content
Advertisement

Tag: pointers

this pointer escape in Java

When reading < Java Concurrency in Practice >, there’s an example saying that the following code snippet will lead to this pointer escape in the constructor method. But I’m not sure what exactly does it mean, since I couldn’t see any this reference in the source code of ThisEscape constructor method. Any ideas? Thanks. Answer EventListener object is created from

Duplicating objects in Java

I learned that when you modify a variable in Java it doesn’t change the variable it was based on I assumed a similar thing for objects. Consider this class. After I tried this code I got confused. Please explain to me why changing any of the objects affects the other one. I understand that the value of variable text is

Advertisement