i dont understand Whats is static. anyone can explain it pls. ando give me an example. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

i dont understand Whats is static. anyone can explain it pls. ando give me an example.

2nd Oct 2016, 1:58 AM
Silvacho Silvadoray
Silvacho Silvadoray - avatar
5 Answers
+ 2
Static means that you can't make a copy of that... By making static you don't need any instance to make it call.. You just refer it to the main class.. It will automatically called..
2nd Oct 2016, 5:56 AM
Saharsh Pandey
Saharsh Pandey - avatar
0
http://stackoverflow.com/questions/413898/what-does-the-static-keyword-do-in-a-class this explanation is incredibly good. In a nutshell, static means it belongs to the class.
2nd Oct 2016, 2:14 AM
Mythos
0
thanks
2nd Oct 2016, 2:40 AM
Silvacho Silvadoray
Silvacho Silvadoray - avatar
0
Static function means that you do not need to create an object to call that function. just use ClassName.functionName(); and it'll run.
2nd Oct 2016, 11:41 AM
chetan acharya
chetan acharya - avatar
0
Static members are class members and hence they cannot be instantiated. Note that a static member cannot access non static members.
6th Oct 2016, 5:00 PM
Saurabh Kumar Sharma
Saurabh Kumar Sharma - avatar