Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!novia!news-out.readnews.com!transit3.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.help Subject: Re: Disposing of Objects? Date: Tue, 15 Nov 2011 13:00:13 -0800 (PST) Organization: http://groups.google.com Lines: 38 Message-ID: <32338133.385.1321390813619.JavaMail.geo-discussion-forums@prfb5> References: <752b3c45-6455-4f52-8cf8-d2ba7714b51f@p16g2000yqd.googlegroups.com> <14847360.425.1321373842152.JavaMail.geo-discussion-forums@prgt40> Reply-To: comp.lang.java.help@googlegroups.com NNTP-Posting-Host: 2620:0:1000:2404:224:d7ff:fe69:5838 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1321390902 31421 127.0.0.1 (15 Nov 2011 21:01:42 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 15 Nov 2011 21:01:42 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2620:0:1000:2404:224:d7ff:fe69:5838; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.help:1350 Davej wrote: > Lew wrote: >> [...] >> >> What do you mean by "reinstantiating"? >> > > > I have q declared as a global inside the main class... No, you don't. Java doesn't have globals. > public class MortgageView extends FrameView { > Mortgage q;//globals That isn't even 'static', much less "global". Stop calling that "global". It's the very opposite of global. > ...then inside the button event handler I execute... > > q = new Mortgage(amt, term, int);//creates table Creates a new instance of 'Mortgage', then assigns the pointer value (*not* the object) to 'q'. Whatever pointer value 'q' used to hold is now gone from 'q', erased by the new pointer value. Yes, I am repeating what others have been saying. > ...if the button is pressed again the statement is executed again. I > would call this "reinstantiation." And you would be wrong. -- Lew