[671] in java-interest

home help back first fref pref prev next nref lref last post

Re: lifetime of objects

daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Wed Jul 12 18:12:15 1995

Date: Wed, 12 Jul 1995 13:58:22 -0800 (PDT)
From: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
Reply-To: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
To: java-interest@java.Eng.Sun.COM, Lein Ton <ton@cc.gatech.edu>


Hi Lein,

> I can remember that creating new objects in C++ within methods was one
> of the most certain way of getting a core dump.
> The next java program seems to work, but can I be sure that the
> instances that created in add() of HtContainer have the same lifetime
> as the hashtable in HtContainer?

Java uses a garbage collector. This means that you never have to worry
about the lifetime of objects. As long as you can reference them somehow
the are alive.

Have fun,

	Arthur van Hoff


-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post