This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes static variable inside a function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "static variable inside a function" Watch "static variable inside a function" New topic
Author

static variable inside a function

jason picardo
Greenhorn

Joined: Oct 29, 2000
Posts: 14
Hi,
I hava a samll problem please help me out.
I tried to declare a static variable inside a funtion,the compiler gave me a error. I want to know why it is not possible to declare a static variable inside a function in java where as
it possible in c++.
Thanks.
E-mail: jason_jp@usa.net
[This message has been edited by jason picardo (edited November 16, 2000).]
Mary Anitha
Greenhorn

Joined: Oct 13, 2000
Posts: 23
We cannot declare static variables inside a method
coz the scope will be limited to that method
asim wagan
Ranch Hand

Joined: Nov 14, 2000
Posts: 62
Understand this way:
non static variables are for classes ,methods.
static variables remember are always for classes.
 
Consider Paul's rocket mass heater.
 
subject: static variable inside a function
 
Similar Threads
static variable inside function definition
static variable inside static function
Static
can I declare an duse a cursor inside a function ?
Static Main function VS Static user define function