静态变量,什么是他们的寿命?他们的、变量、静态、寿命

2023-09-04 09:14:09 作者:听闻你的曾经

我在我的应用程序中使用静态变量,其中很多。我的问题是,当我退出程序,他们将仍然在内存..?如果是的话,我怎么能纠正这一问题。先谢谢了。

I am using static variables in my app, lots of them. My question is, when I exit the app will they be still in memory..? If yes, how can I correct this. Thanks in advance.

推荐答案

中的静态变量当类是由类加载器加载被加载,并会被删除的当它被卸载

Static variable gets loaded when class is loaded by ClassLoader, and would be removed when it is Unloaded