In Java, how would I do the following:
Foo bar = new Foo();
Foo a = bar;
Foo b = bar;
bar = null;//will only set bar to null. want to set value of bar to null rather than the reference to null.
Is it possible to set the variables bar
, a
and b
(all are a reference to bar
) to null only with access to bar? If so, could somebody please explain how to do so.