can we change a static variable value by using it on other classes ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can we change a static variable value by using it on other classes ?

if in my first class I declared a static variable a=10 . can I change that value in other class by calling it by Class.a ?

14th Sep 2016, 3:07 PM
Jithin Sathianandan
Jithin Sathianandan - avatar
1 Answer
+ 2
If the static variable is public, then yes.
14th Sep 2016, 3:33 PM
Zen
Zen - avatar