Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1350

Re: Disposing of Objects?

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.help
Subject Re: Disposing of Objects?
Date 2011-11-15 13:00 -0800
Organization http://groups.google.com
Message-ID <32338133.385.1321390813619.JavaMail.geo-discussion-forums@prfb5> (permalink)
References <752b3c45-6455-4f52-8cf8-d2ba7714b51f@p16g2000yqd.googlegroups.com> <j9tv9q$dvi$1@dont-email.me> <14847360.425.1321373842152.JavaMail.geo-discussion-forums@prgt40> <a6100ea3-c1bd-450e-9750-1277fc00c8bd@w1g2000vba.googlegroups.com>

Show all headers | View raw


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

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Disposing of Objects? Davej <galt_57@hotmail.com> - 2011-11-15 06:59 -0800
  Re: Disposing of Objects? markspace <-@.> - 2011-11-15 07:08 -0800
    Re: Disposing of Objects? Lew <lewbloch@gmail.com> - 2011-11-15 08:17 -0800
      Re: Disposing of Objects? Davej <galt_57@hotmail.com> - 2011-11-15 09:56 -0800
        Re: Disposing of Objects? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-15 10:10 -0800
          Re: Disposing of Objects? Davej <galt_57@hotmail.com> - 2011-11-15 12:15 -0800
            Re: Disposing of Objects? markspace <-@.> - 2011-11-15 12:51 -0800
        Re: Disposing of Objects? Lew <lewbloch@gmail.com> - 2011-11-15 13:00 -0800
        Re: Disposing of Objects? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-15 21:59 -0500
          Re: Disposing of Objects? markspace <-@.> - 2011-11-15 19:13 -0800
            Re: Disposing of Objects? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-15 22:32 -0500
  Re: Disposing of Objects? Davej <galt_57@hotmail.com> - 2011-11-15 08:08 -0800
    Re: Disposing of Objects? markspace <-@.> - 2011-11-15 08:32 -0800
    Re: Disposing of Objects? Lew <lewbloch@gmail.com> - 2011-11-15 12:57 -0800
  Re: Disposing of Objects? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-16 06:23 -0800

csiph-web