+ 1

Can we reintialize the static variable

4th Dec 2021, 7:41 AM
NAGA SUBBAIAH
2 Respostas
+ 3
we can, if there is not final modifier public class Prog { static int v=10; public static void main(String[] args) { System.out.println(Prog.v); Prog.v = 20; System.out.println(Prog.v); } }
4th Dec 2021, 8:07 AM
zemiak
+ 1
I think it is feasible, as long as the method modifying the value was also a static member (static method). Do you have a code in relation to this doubt? can you share its link in your thread's Description? https://www.sololearn.com/post/75089/?ref=app
4th Dec 2021, 7:48 AM
Ipang