[program-java] Re: Instance...

  • From: "George Bell" <george@xxxxxxxxxxxxxxxxxxx>
  • To: <program-java@xxxxxxxxxxxxx>
  • Date: Wed, 11 Feb 2009 13:25:33 -0000

Hi Jim,

As you know, I'm no programmer in any shape or form, let alone Java,
but should the "new" after "Client.New" be spaced like that?  It just
looks odd sat there on it's own.  (O.K. I'll crawl back under my
stone.)

Client.New new = client.New(display, shell);

George.

-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Corbett, James
Sent: 11 February 2009 13:11
To: program-java@xxxxxxxxxxxxx
Subject: [program-java] Re: Instance...

I have a class titled Main, with in that class I create an instance of
my class MainMenu.

The object mainMenu now has a listener method. With in the method are
selection events for each menu option.

Suppose I click on New from the menu.... The mainMenu.getNewItem event
is triggered and loads the class New:

Client.New new = client.New(display, shell);

So lower case new is a instance of upper case class New.  ...by
creating the new object a screen gets loaded, etc.

There is no problem and no issues but the compiler spits a warning to
the affect that the variable new is never used locally. I can live
with that since it's only a warning but I thought that there might be
a way of not actually creating the new object and still achieving the
same thing?

Jim  

-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Adrian Beech
Sent: February 11, 2009 02:57
To: program-java@xxxxxxxxxxxxx
Subject: [program-java] Re: Instance...

G'day, scratch head, I'm trying to get my head around your question...
what is the role of newClass in relation to the construction of the
GUI?

Cheers.
AB

-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Corbett, James
Sent: Wednesday, 11 February 2009 4:15 AM
To: program-java@xxxxxxxxxxxxx
Subject: [program-java] Instance...

...is there a means to create an instance of a class with out actually
specifying an object name?

E.G. Class newClass = Class();

I would like not to have newClass created even though it's scope is
limited to the calling method. If I leave it as it is, the compiler
will throw a warning indicating the object newClass is never called
locally.

I use the above syntax for loading a gui class which never gets used
other than to create the gui in the first place.

Just wondering.

Jim 

James M. Corbett

A / Technical Specialist
GST/HST Micros | Micros de la TPS/TVH

(613) 941-1338

"Not good science? Why, before writing RELIC, we did extensive
scientific research on the worldwide problem of brain-eating monsters
infesting museums. What more could you want?"

                            -- Douglas Preston




__________ NOD32 3844 (20090211) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com





Other related posts: