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

What is static in java

ee

10th Jan 2018, 7:22 PM
Bismillah
Bismillah - avatar
2 Answers
+ 1
When there are 2 Objects instantiated on the same class, they can access a global variable of that class, and provide a different value same global variable because they are 2 different objects, and this is the only way to access a (none private) global variable outside the implementing class. When a static global variable is declared, it's call "Class Variable", and it can be called either instantiating objects of that class or simply calling that variable directly with the syntax <ClassName>.<VariableName>, the last value provided is the the value that the variable will hold. Good luck Bismillah.
10th Jan 2018, 8:27 PM
Roberto Guisarre
Roberto Guisarre - avatar
10th Jan 2018, 9:04 PM
Dan Walker
Dan Walker - avatar