-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?

2
  • Next time please spend a minimum of 10 seconds on Google first. Commented Jul 8, 2016 at 17:56
  • @takendarkk stackoverflow works as my google ! Commented Jul 8, 2016 at 18:03

1 Answer 1

-1

Yes. A static field is shared by all instances of a class and is accessible in instance (non static) methods.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.