There is no destructor in Java, for example, in C:
If you knew you wanted to set multiple objects to null, then you are likely to use the Foo array, rather than declaring them as separate objects. Then use loops for consturctor calls, initialization / initialization.
Foo bar = new Foo(); Foo array[2] for (int i=0; i<array.length; i++) { array[i] = bar; }
Then you can use a loop at the end
for (int i=0; i<array.length; i++) { array[i] = null; }
This is the strategy you want to use for Data Structures because you can process any number of objects, for recursion, etc.
Jason K.
source share