What's the purpose of Static methods and static variables?

DWQA QuestionsCategory: JavaWhat's the purpose of Static methods and static variables?
Editor Staff asked 2 months ago

What’s the purpose of Static methods and static variables?

1 Answers
Editor Staff answered 2 months ago

When there is a requirement to share a method or a variable between multiple objects of a class instead of creating separate copies for each object, we use static keyword to make a method or variable shared for all objects.