Enjoy Learning.
Geek Repo:Geek Repo
Github PK Tool:Github PK Tool
wslqm123 opened this issue 7 years ago · comments
讲解栈与堆的区别用的例子
public class Sample { int s1 = 0; Sample mSample1 = new Sample();
public void method() { int s2 = 1; Sample mSample2 = new Sample(); }
}
mSample1 不能直接在声明全局变量的时候创建,这样会无限调用然后内存溢出, 虽然只是个为了说明堆栈的例子,但还是希望能改一下