considering the following class
public class Holder{
Holder child;
/* some other variables */
Holder(boolean hasChild){
child = ( hasChild ) ? new Holder(false) : null;
}
/*some other functions
.
.
*/
and in the Java program i make a new object that has a child like this:
Holder parent = new Holder(true) // making it having a child Holder
The Question : Now how i can delete that holder parent and all it's children from the memory is it enough to just do
parent = null
i'm not sure if that also makes all children null too !
Why i need this ? :
i really need this answer i'm new to programming and i'm trying to make a binary tree but when i delete a node in the tree i want to make sure that all it's child nodes are also deleted from the memory ... i hop that helps in giving me a c=good answer ...