[Solved] Java never declares access level of variables in methods whether static or not [closed]


Because it doesn’t make sense. Variables declared in a method are local to the method; i.e. they can’t be accessed outside the method. Why and how could these variables be modified outside the method? Code outside the method doesn’t even know of them, so you don’t need to protect them from outside code.

solved Java never declares access level of variables in methods whether static or not [closed]