Possible Duplicate:
Why are static variables considered evil?
Having studied Object oriented programming and design in college a few years back, i remember lecturers getting pretty angry at people using static variables or static methods, as they describe static to be of a very bad design.
My understanding is this
Something of type static, is something that gains global “vision” i.e. it can be accessed by anything.
Is my understanding correct? is there information about the use of static that makes it bad use? and is there a way to avoid using static variables or methods in your code?
btw, i am aware that static for the main method is a pre-requisite to the successful operation of the application.
static mainly used for to accessing class members without creating class instance. As you know that why we are writing
public static void main()just bcoz at the run time jvm can access this method without creating the class object and start up your program.Its depending on your requirement that how you used or say how to declaring member of class using access specifier as private, public, default and protect for access level while the static was for make that as static with access level.
Without static you must declare your member as public or if you inherit your class then make as protected also. As in the same package you define the class then just static for inheriting the class. And for using without inhert class you need to create object of that class and then you can access there members (Note it based on access specifier)
here is the link below for more detail
http://xahlee.info/java-a-day/access_specifiers.html
http://www.javabeginner.com/learn-java/introduction-to-java-access-modifiers