On Monday, 06/10/2002 at 03:35 ZE9, Emiko Kezuka
<[EMAIL PROTECTED]> wrote:

> Static method (in a class) is a method which NEVER be instanciate.
> that is, Static method is used as it is and never allocated anew for each
uses.

OK, so far, sort of...

> that is, you cannot use instance variables (I mean by "instance
variables" the
> variables which is declared within the method) ,

Bit of a naming problem here.  Variables declared within a method are
actually called "automatic" variables, since they come into being
"automatically" when the method is called.

> or the value of that variables
> can be altered in any time (by another call of this method from
elsewhere
> which tries to run this very method from the beginning and may alter the
value
> along to it).

No, every invocation of a method has its own automatic storage area (carved
out of the stack), so every method -- static or not -- can have automatic
variables that are only accessible within the method itself.  Think of
automatic variables as "living" in the stack -- when the method is called,
room is made for auto variables in the stack.  When the method returns, the
stack is popped and the storage is automatically freed.

Hope this helps.

-blair

Blair Wyman -- iSeries JVM -- (507) 253-2891
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"It is a sobering thought that when Mozart was my age,
he had been dead for two years." -- Tom Lehrer




To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to