p*s
8 楼
c++ 里,variable在哪,实例就在哪。
java里面,primitive type在variable里,reference type的variable从stack指到
heap的实例
隐约记得是这样。 谁来确定确定
java里面,primitive type在variable里,reference type的variable从stack指到
heap的实例
隐约记得是这样。 谁来确定确定
j*u
16 楼
Not sure about Java... does Java has boxing/unboxing also?
if so, primitive (value) type could be in the heap as well:
object o = 1234;
besides boxing, there're other cases that value type does not live in the st
ack, an exmaple is array of value type.
int[] myArray; // all int value of the array lives in the heap.
So, it is not accurate to say "value type goes to the stack, reference type
goes to the heap".
also, there is no variable "name" in the stack, it is actually an address (x
86: 4 bytes, x64: 8 bytes) that points to the begining of the memory block f
or the object in the heap.
【在 f*******y 的大作中提到】
: 感觉你是对的
: primitive type的变量存在stack里
: reference type的variable名存在stack里,其内容也就是reference指向的instance存
: 在heap里
if so, primitive (value) type could be in the heap as well:
object o = 1234;
besides boxing, there're other cases that value type does not live in the st
ack, an exmaple is array of value type.
int[] myArray; // all int value of the array lives in the heap.
So, it is not accurate to say "value type goes to the stack, reference type
goes to the heap".
also, there is no variable "name" in the stack, it is actually an address (x
86: 4 bytes, x64: 8 bytes) that points to the begining of the memory block f
or the object in the heap.
【在 f*******y 的大作中提到】
: 感觉你是对的
: primitive type的变量存在stack里
: reference type的variable名存在stack里,其内容也就是reference指向的instance存
: 在heap里
相关阅读
报一个offer, 并请教salary negotiation又求祝福Java/C++ Developer in Middletown, NJ[UPDATE]面经。 今天电面, 希望好运!请问一些描述职位要求的术语该更新置顶的H1数据啦说周一给结果,发邮件打电话都不回,这种什么情况opt california center大家帮我看看怎么和公司说合适,多谢~10月中opt到期,现在file H1B来得及么?微软能投多个职位么?美国硕士毕业能去加拿大工作吗急问,phd换专业到master的OPT能不能用的问题吐血啊内伤啊,今天intel电面被老印摆了一道~关于OPT90天unemployed过期,是不是只要拿到OFFER就可以了,有经验的进来说说?有人在Cerner (Healthcare system) 工作吗?电面开头怎么寒暄一下好一些?有点挺不住了毕业多长时间能转身分到H-1?湾区entry level phd contractor的工资一般是多少呢?