shlogg · Early preview
Mercy @mercy_tari14000

Static Vs Instance Variables: Understanding The Key Differences

Static vars share state across all class instances, while instance vars are unique to each object. Static methods can't access instance vars, only static ones.

Static vs Instance Variables

Whenever a variable is declared as static, this means there is only one copy of it for the entire class, rather than each instance having its own copy. 
Static variable 
When a static variable is declared, a single copy of the variable is created and shared among all objects at the class level. Static variables are, essentially, global variables. All instances of the class share the same static variable.
Important points to note on static variables
We can only create static variables at the class level. 
static block and static variables are executed in the order...