Hey here is a great help
A static variable is intilized when the class is loded. Which means that
the static variable will have the same value regardless of the number of
objects we create from that class. And the value of that static variable is the same in all objects of that class.
Example let say there is a static variable x in class animal
lets say we create an object called cat from the class animal and also an object dog.
the value of the vairable x is the same in both cat and dog always.
if we make
then the x in dog will also be 9.
Hence, static variables can be used to share a common information
between objects of the same class. For example the number of legs is
common to both cats and dogs