Call Us : +91-8376986802 (Viber, WhatsApp)

What are static variables?



Static variables are the variables which has exactly one copy per class. They belong to the class as a whole but not for its instances (objects). All static variables are declared by using the modifier ‘static’.

For example:

Static type varidentifier;

where type is the data type and varidentifier is the variable.
All static variables are initialized automatically with a default value but not explicitly initialized. The default value is depended on the data type of the variables.

Leave a Reply