Java – is it bad practice to save data in static variables?
(this exact question may have been asked before. I can't find it through search. If you find that it has duplicate tags.)
In Android applications, isn't it bad to store objects in static fields in these cases?
>Application data Isn't it bad to keep application data in static variables in classes while the application is running? At present, I store the data in the instance variable of the application class Then, the class that needs data can get data from application. > Context, etc Is it a bad practice to store a context (such as a reference to an activity or application) in a static field? This can be used in required classes, such as layoutinflator or resources For now, I pass contexts to methods that require them as arguments
Solution
Yes, yes
The above is the Java compiled by programming house for you - is it bad to save data in static variables? I hope this article can help you solve Java - is it a bad practice to save data in static variables? Program development problems encountered.
If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.