In C/C++ we use static local variables for maintaining a method\'s state. But why it is not supported in Java?
Yes, I can use an static field for this purpose. But i
instance methods are invoked by the instance(objects) of the class . Static things belongs to the class not to the object that's why local variables are not static.Instance variables are static and they can also initialized at the time of class loading by static blocks. enter image description here
for more information please visit :- https://www.youtube.com/watch?v=GGay1K5-Kcs&t=119s