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

Explain importance of inheritance in java?

604


Can a set contain duplicates?

515


Why do you canvas?

606


What’s the difference between callable and runnable?

543


Have you ever used hashtable and dictionary?

569






Which graphs are functions?

490


What is the basic of java?

566


How to perform selection sort in java?

580


Why Set interface contains unique elements, what internally implemented for this so that it contains unique elements?

7406


Can a source file contain more than one class declaration?

509


What is method and methodology?

608


How do you reverse sort in java?

498


What is integer parseint?

544


how to prepare for IT Officers Interview in Banks

1500


Differentiate between a class and an object.

560