
What is the exact need of declaring a variable as static?

A static variable is a variable who's single copy in memory is shared by all objects,so any modifications to the static variable will modify it's value in all objects.They are not re-created or re-initialized.
Static variables are used when only one copy of the variable is required.

Have a look at the following link:
http://www.roseindia.net/java/beginners/staticvariable.shtml
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.