在今天的工作中,我遇到了volatileJava中的关键字.我不太熟悉它,我发现了这个解释:
鉴于该文章解释了相关关键字的详细信息,您是否使用过它,或者您是否曾经看到过以正确方式使用此关键字的情况?
我在ListActivity中使用以下代码
// a separate class in project
public class MyActivity extends ListActivity {
// some common functions here..
}
public class SelectLocation extends MyListActivity {
public void onCreate(Bundle savedInstance) {
// here.....
}
@Override
protected void onDestroy() {
super.onDestroy();
if (adap != null) adap = null;
if (list != null) list = null;
System.gc();
}
}
Run Code Online (Sandbox Code Playgroud)
任何人都指导我为什么onDestroy在我的代码中没有调用方法?