+ 1
Can we reintialize the static variable
2 Réponses
+ 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);
}
}
+ 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