Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes static variable in method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "static variable in method" Watch "static variable in method" New topic

static variable in method

aruna ver

Joined: Jun 24, 2002
Posts: 8
can we declare static variable inside a method
i tried do that i am getting compilation error
pls can anybody tell me why am i getting compilation error
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You can not create a static variable inside a method.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Dan Culache
Ranch Hand

Joined: Jan 24, 2003
Posts: 70
The only accepted modifier for local variable is
I agree. Here's the link:
subject: static variable in method
It's not a secret anymore!