简体   繁体   中英

calling finish() from Activity

i want to know that , is finish(); call effect static variables.? does static variables is affected by GC.

static int displayChart = 0;

code of declaration.

static variable belongs to class not the object , and finish() or garbage collector affects object , therefore it got no influence on static variables. Please note that class does not equals object but object is instance of class .

No there is no effect on static variable by calling finish or gc. You can access those variable from other activity for the proof

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM