-6

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?

takendarkk
  • 3,347
  • 8
  • 25
  • 37

1 Answers1

-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
  • 1
    You 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