By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.

Static variable initailization

P: n/a
Hi There,
I'm new to Java. Having read a bunch of books, I wonder if static
variable is initailized by defualt value? Textbooks only indicate that
instance variable is implicitly initailized.

Thanks in advance,
Black Java
(Student from city of angel)
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Black Java wrote:
Hi There,
I'm new to Java. Having read a bunch of books, I wonder if static
variable is initailized by defualt value? Textbooks only indicate that
instance variable is implicitly initailized.


Static variables are actually called class variables in Java.

Section 4.5.5 in the Java Language Specification, 2nd edition, states:
"Each class variable, instance variable, or array component is initialized
with a default value when it is created"

See
<http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#96595>
for more information.

--
Jonas Kongslund
Jul 17 '05 #2

P: n/a
nos
watch out because "local" variables are not initialized

"Jonas Kongslund" <do**@mail.me.at.all> wrote in message
news:fw*****************@news.get2net.dk...
Black Java wrote:
Hi There,
I'm new to Java. Having read a bunch of books, I wonder if static
variable is initailized by defualt value? Textbooks only indicate that
instance variable is implicitly initailized.
Static variables are actually called class variables in Java.

Section 4.5.5 in the Java Language Specification, 2nd edition, states:
"Each class variable, instance variable, or array component is

initialized with a default value when it is created"

See
<http://java.sun.com/docs/books/jls/s...alues.doc.html
#96595> for more information.

--
Jonas Kongslund

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.