answersLogoWhite

0

I think you're referring to the C/C++ concept of "dangling pointers." This is when you allocate some memory to a pointer, then deallocate that memory, but don't change the pointer. This causes any attempted use of the pointer to return an unused memory address.

There is no such concept in Java, since the programmer has little to no control over how memory is allocated or freed.

The closest thing I can think of is if you're using a class such as a Reader, in which you can close the object (Reader.close()) and then still have a reference to it. But in this case (and other similar cases) attempting to use the Reader further will result in an IOException being thrown.

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

Define dangling if in terms of java?

A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.


Does java support call by reference?

No , Java does not support call by reference.


What are the differences between C and Java reference variables?

Java does not have the concept of Reference Variables. We cannot access the memory location where the data is stored in Java.


Which is the best Book to understand JAVA in short?

You can use Head First Java or Java Complete Reference to learn Java.


What is the best book of java language?

the best book of java is java complete Reference 2nd edition.


What has the author Patrick Niemeyer written?

Patrick Niemeyer has written: 'Learning Java' -- subject(s): Java (Computer program language) 'Learning Java' -- subject(s): Java (Computer program language), Java (programmeertaal) 'Java Reference Library on the Web'


What does the 'this' reference do in Java?

Represents the current object (not usable in static methods).


In java all variables declared using a class are?

Reference variables


How do you use the word dangling in a sentence?

The climber was left dangling for his life on the edge of the cliff.She did not like the way the bracelet was dangling when she drove.Somehow, there is a sock dangling from the tree.


How can you study easy to develop applications using java?

There is a good book called Java - The Complete Reference. This would be a good place to start.


Why pass by reference is quicker than pass by values in java?

Pass by Reference does not create a copy of the data items. So, it is faster.


Difference between reference and object in java?

On the lower level of Java, a "reference" can be thought of like a pointer in C. It is essentially an integer which refers to (points to) a location in memory where the object data exists. // "button" is a reference to a JButton with a "1" on it (the object). JButton button = new JButton("1");