| Author |
difference between static local variables and static global variables.
|
bharadwaz reddy
Greenhorn
Joined: Jul 08, 2009
Posts: 4
|
|
hello,
please somebody explain me,the difference between static local variable and static global variable. with example programs.
|
 |
Sachin Adat
Ranch Hand
Joined: Sep 03, 2007
Posts: 213
|
|
How did you come arrive at this question.............
I've never heard anything about static local variable
|
SCJP 6
How To Ask Questions On Java Ranch - How To Answer Questions On Java Ranch
|
 |
Aurelian Tutuianu
Ranch Hand
Joined: May 13, 2004
Posts: 86
|
|
This is a C question, not a Java one.
In Java the state is carried out by class instances. So you end up with static member variables.
|
http://javasign.blogspot.com/
|
 |
Ken Truitt
Ranch Hand
Joined: Aug 23, 2007
Posts: 124
|
|
compile error--illegal start of expression 'static int...'
|
SCJP 88% | SCWCD 84%
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32708
|
|
|
There is no such thing as a static local variable in Java; as Ken Truitt has shown, you mustn't even use the static keyword inside a method.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
In C this was necessary to not completely polute the global namespace. In Java, classes already split up the namespace, so a static field will work just fine.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32708
|
|
|
And the static keyword in Java means something different from the static keyword in C.
|
 |
 |
|
|
subject: difference between static local variables and static global variables.
|
|
|