Healthesystems Interview Question

What do you use static keyword for? Warning, warning, indication they are creating poor code.

Interview Answer

Anonymous

Jan 12, 2018

It should only be used in corner cases. Statics have a lifetime that matches the entire runtime of the program. This means, even once you're done using your class, the memory from all those static variables cannot be garbage collected. Statics violate the principle that data is encapsulated in objects (that can be extended, information hiding, etc). Many more reasons, but I'll let them Google it.

2