Can you declare a static variable in a method?

Answer Posted / ali

No Static Variable cannot declare in method.
but the method present in class can access the static variable
of class.
Or the method which is trying to access the static variable of
class but method is not part of that class at that time declare method as static then it can access that static variable.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is native code?

731


Can an interface be defined inside a class?

754


What is tree node in java?

720


What is array sorting in java?

777


What is a protected method?

846


Which collection is thread safe in java?

736


What is hashing in java?

776


What is getclass () getname () in java?

883


What happens when I use / and % with a negative numerator?

774


Does java have a compiler?

785


Is it possible to compare various strings with the help of == operator? What are the risks involved?

838


What is the diffrence between inner class and nested class?

813


Is .net better than java?

765


What is communist flag?

770


What are the wrapped, classes?

791