Good point, that's exactly what's going on with the Java runtime. And it's a good distinction to point out as that behavior is how the garbage collector knows when to clean up objects: when there are no more references pointing to an object, its memory can be freed.
That being said, this is all transparent to the programmer writing Java code, so while there may be multiple references under the hood, to the developer it just looks like a single shared object. You'd never really notice the difference in reference and value types in a local scope, but the behavior of these different types as they are passed between methods becomes significant and important to understand.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Good point, that's exactly what's going on with the Java runtime. And it's a good distinction to point out as that behavior is how the garbage collector knows when to clean up objects: when there are no more references pointing to an object, its memory can be freed.
That being said, this is all transparent to the programmer writing Java code, so while there may be multiple references under the hood, to the developer it just looks like a single shared object. You'd never really notice the difference in reference and value types in a local scope, but the behavior of these different types as they are passed between methods becomes significant and important to understand.