🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.java
Article #894

Re: Static Method ? Static Variable ?

#894
From: Hartmut Dieterich
Date: Thu, 02 Mar 2000 00:00
48 lines
2384 bytes
AFAIK, "static" in Java means class-related, i.e. a static variable is a
variable (not a constant!) common to all instances of one class, and a
static method is a method only available by a class reference, not an
instance (e.g. Runtime.getRuntime()  is a method of _class_ Runtime, and it
returns an _instance_ of this class; main() is  another example of class
method, therefore: "[public] static [void]")
What Boyick Mhlanga refers to is "final": classes and methods can be
declared final to prevent overriding, final "variables" are like constants,
i.e. they can only be assigned a value at creation time.

-- Hartmut



Boyick Mhlanga schrieb:

> Most java books do explain these
>
> a static method is a method that cannot be overriden. once defined in
> class sub  classes cannot redefine the method.
>
> a stativ variable is a variable that cannot be reassigned a new value eg
>
> private static int i=0;
>
> creates a variable that is initalied to 0 any attemps to assign another
> value to i will result in an error. besides static variables belong to
> the class not instances of the class.
>
> any java text will give explanations to these as well as examples
>
> Good luck in your studies
>
> Robert wrote:
>
> > Hi,
> > I'm a first year IT student, I need to find out
> >
> > A) What is a Static Method
> >
> > b) What is a Static Variable
> >
> > or if u know where i could find the information.
> > Thanks for ur help.
> >
> > Cheers
> >
> > Robert
Technical Details
Message-ID: <38BE758A.AB17BB33@mchsiemens.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6wmv4.1491$vW.3803@news-server.bigpond.net.au> <38BDFEA3.EFF33FCF@nexted.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d6db,9fd80fce16393cf3
X-Google-Attributes: gid10d6db,public
From: Hartmut Dieterich <Hartmut.Dieterich@mchsiemens.de>
Subject: Re: Static Method ? Static Variable ?
Date: 2000/03/02
Message-ID: <38BE758A.AB17BB33@mchsiemens.de>
X-Deja-AN: 592226600
Content-Transfer-Encoding: 7bit
References: <6wmv4.1491$vW.3803@news-server.bigpond.net.au> <38BDFEA3.EFF33FCF@nexted.com>
To: Boyick Mhlanga <boyick.mhlanga@nexted.com>, mwalker1@bigpond.net.au
X-Accept-Language: de
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: usenet@mchh.siemens.de
X-Trace: galaxy.mchh.siemens.de 952005986 17811 132.66.101.163 (2 Mar 2000 14:06:26 GMT)
Organization: Siemens AG,(Hofmannstr)  Munich-Germany-Europe.
Mime-Version: 1.0
NNTP-Posting-Date: 2 Mar 2000 14:06:26 GMT
Newsgroups: aus.computers.java