What differentiates static variables from local variables and instance variables? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What differentiates static variables from local variables and instance variables?

29th Oct 2016, 9:48 PM
lash-1K
2 Answers
0
Different in scope of visibility, initialization order and lifetime. Static variable is available for the entire class and his descendants and is one for all of them. But for static methods. Exists always. Instance var visible for entire class for all his methods. Exists until class instance exists. Local var visible and available only in the border of his method. Exists to the end of method. Initialization order: static instance local
31st Oct 2016, 11:23 PM
Victor IT
Victor IT - avatar
0
Thank you.
1st Nov 2016, 12:03 AM
lash-1K