Can a non static method in java modify a static variable declared locally in a class or is it only a static method can modify a static variable in the class?
Asked
Active
Viewed 80 times
-6
-
Next time please spend a minimum of 10 seconds on Google first. – takendarkk Jul 08 '16 at 17:56
-
@takendarkk stackoverflow works as my google ! – Pruthvi Ustepalle Jul 08 '16 at 18:03
1 Answers
-1
Yes. A static field is shared by all instances of a class and is accessible in instance (non static) methods.

Juan C Nuno
- 476
- 1
- 3
- 8
-
1You shouldn't answer incredible bad questions like this one. This just attracts more bad questions and won't serve the community or the page. – Tom Jul 09 '16 at 00:06