why cannot the static variable declare inside the method
Static variables are class level variables. Static means one per class as per OO rules and method level variables scope is with in the method. So java does not allow static variable to be declared inside a method.
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.