wood burning stoves
The moose likes Beginning Java and the fly likes Static Local Variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Static Local Variable" Watch "Static Local Variable" New topic

Static Local Variable

Mathew Kuruvilla
Ranch Hand

Joined: Nov 27, 2001
Posts: 141
Why can't I get a static local variable???
Nain Hwu
Ranch Hand

Joined: Sep 16, 2001
Posts: 139
That's the design of the java language.
The only modifier allowed for local variable is final.
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
The word static means that it belongs to the whole class. It's lifetime starts when the class is loaded and dies when the class is unloaded - which for the most part means when the JVM goes down.
The word local means that it is only created when the method starts, and it dies when the method is over.

Can't be both at once, now, can it?

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link: http://aspose.com/file-tools
subject: Static Local Variable
jQuery in Action, 3rd edition