Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道,是finish();调用效果static变量。?变量是否static受 GC 影响。
finish();
static
static int displayChart = 0;
声明代码。
staticclass变量不属于object, 和finish()or 垃圾收集器影响,因此它对变量object没有影响。请static注意class不等于object而是object的实例。class
class
object
finish()
不,调用finish或gc对静态变量没有影响。您可以从其他活动中访问这些变量以获取证明