What does/is static | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does/is static

I don't understand what static is or what it does and that bothers me. any help?

11th Jun 2017, 4:35 AM
Hyper jenkins
Hyper jenkins - avatar
3 Answers
+ 2
Google it
11th Jun 2017, 5:34 AM
SoakedInAllan
SoakedInAllan - avatar
+ 2
In case of static variable , when we define a variable within a class, it is actually generated several times, once in each object we create. Sometimes we want to define variables that are defined once for all objects of a particular type. For example: a variable that contains the number of objects created from a particular class (class). This variable is called a static variable. A static variable is a variable that has only one instance and is shared by the whole class (as opposed to a regular 'duplicate' variable for each object from the class). A static variable is found only once in memory, no matter how many object instances the class has. you could define also methods and classes as static .
11th Jun 2017, 5:53 AM
Loai Hazima
Loai Hazima - avatar
0
Thanks, I don't get it 100% but I got something out of it
11th Jun 2017, 3:42 PM
Hyper jenkins
Hyper jenkins - avatar