A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
Programmer Certification (SCJP/OCPJP)
Joined: Jul 07, 2003
Aug 12, 2003 11:25:00
Are variables declared in static methods static by default?
Joined: Jun 02, 2003
Aug 12, 2003 11:38:00
No, the variables in a static method cannot be static by default;they have to be declared explicitly static.By default, they r non-static
Joined: Jun 13, 2000
Aug 12, 2003 12:15:00
Variables declared in a method are neither static (Class Variables) or non-static (Instance Variables) they are Automatic Variables (or Local Variables) and as such are not part of the state of an Object which is they only way static and non-static have any context.
I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
I agree. Here's the link:
subject: Static variables
Static variables must store ?
static mathods/variable inheritance
final static variables in beans?
static variables in multithreading
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014