Pregunta de entrevista de Postmates

What is a static variable and when should you use them?

Respuesta de la entrevista

Anónimo

9 sep 2018

Static variables are initialized when its associated class is created and only gets garbage collected when it's class is destroyed. A good example (but also seems to be controversial) when to use static variables would be when using the singleton approach to ensure an object is only initialized once during your app's lifecycle.