All class objects share a static variable. But when is memory allocated for a static variable? Is this when the first object is created for the class? Or does this happen even before any instance of the class is created? Also, an instance variable is allocated memory at runtime. Is memory for a static variable allocated at runtime or compile time?
source share