Welcome! Enter your question below. Please use words like "Who, What, Where, When, Why, How, etc..." in your question. Nothing to ask? Click here for a random, un-answered question.

When use static in java?

1,021,886questions on
Add New Page
Add New Page Talk0

Static is a keyword used to show that something (could be a method or a variable) is associated with the class rather than a particular object.

So one use could be to count how many objects have been created using a static variable. if you used a normal variable it wouldn't work as each object would create its own copy of the variable.

Also on Fandom

Random Wiki