avatar
java 的内存分布?# Java - 爪哇娇娃
A*s
1
南京大学学生原创音乐集《影秋》
车窗
作词:陶岸君
作曲:陶岸君
编曲:高小琪
演唱:陶岸君 高小琪
琪:隔开了冰冷的冬季
摇摇晃晃这车厢里
起了雾的车窗玻璃
伸出手写下了你的名
微寒的指尖沾着水滴
君:转身望见车窗的痕迹
隐隐约约若即若离写着你
我的字迹让我确定
确定是某个同样天气
写下的想念今天显影
合:窗外是怎样的风景
晴天或是下雨我看不清
朦朦胧胧只有穿过
你的名字才会清晰
玻璃上滑落的水滴
证明我有多少次想念你
无论再过几个冬季
怎样都擦不去
一天又一天的过境
我只能如此欺骗着自己
整个车窗上写的都是你
假装你还没有离去
一站又一站不用停
无所谓要把我带去哪里
我的世界不再有你
只剩这流泪的玻璃
avatar
x*i
2
class被load到memory里。所以有一块是code segment
stack 和 heap 分别是低到高,高到低 分享以大块。
请问 string 字符串 常量 会放在哪里?
String str1 = "abcd";
String str2 = new String("abcd");
按我的理解str1 是放在一块特殊的data segment。
而str2 是放在heap里面,不知这样是否理解准确?
avatar
A*s
3
自己顶,难道没人听吗?
avatar
g*e
4
string literal is saved in perm generation.
str2 is in heap like any regular class until str2.intern() is called.

【在 x***i 的大作中提到】
: class被load到memory里。所以有一块是code segment
: stack 和 heap 分别是低到高,高到低 分享以大块。
: 请问 string 字符串 常量 会放在哪里?
: String str1 = "abcd";
: String str2 = new String("abcd");
: 按我的理解str1 是放在一块特殊的data segment。
: 而str2 是放在heap里面,不知这样是否理解准确?

avatar
M*N
5
正在听~bbs有点慢~

【在 A*******s 的大作中提到】
: 自己顶,难道没人听吗?
avatar
x*i
6
那static变量是不是也在perm generation里?
avatar
M*N
7
这个女生让我想起苏打绿,汗一下。。。
男声很有学生气,不错。

width=400&volume=100&showstop=1&showvolume=1&showloading=always&loop=1&bgc
olor1=80ffff&mp3=http://jjkkforever.dyndns.org/shared/window.mp3

【在 A*******s 的大作中提到】
: 自己顶,难道没人听吗?
avatar
g*e
8
yes

【在 x***i 的大作中提到】
: 那static变量是不是也在perm generation里?
avatar
A*s
9
倒……你这么一提还真有一点点像……
不过我听这首歌在前,所以当时没觉得别扭

【在 M****N 的大作中提到】
: 这个女生让我想起苏打绿,汗一下。。。
: 男声很有学生气,不错。
:
: width=400&volume=100&showstop=1&showvolume=1&showloading=always&loop=1&bgc
: olor1=80ffff&mp3=http://jjkkforever.dyndns.org/shared/window.mp3

avatar
x*i
10
avatar
wh
11
不错。你又有同感了?这些人都是南大的学生?

【在 A*******s 的大作中提到】
: 倒……你这么一提还真有一点点像……
: 不过我听这首歌在前,所以当时没觉得别扭

avatar
k*p
12
str1: string pool at perm
str2: heap
str1 != str2

【在 x***i 的大作中提到】
: class被load到memory里。所以有一块是code segment
: stack 和 heap 分别是低到高,高到低 分享以大块。
: 请问 string 字符串 常量 会放在哪里?
: String str1 = "abcd";
: String str2 = new String("abcd");
: 按我的理解str1 是放在一块特殊的data segment。
: 而str2 是放在heap里面,不知这样是否理解准确?

avatar
A*s
13
恩那,我们都是

【在 wh 的大作中提到】
: 不错。你又有同感了?这些人都是南大的学生?
avatar
m*k
14
was asked this question:
String a = "abc";
String b = "ab";
how many strings are created, the answer from the interviewer is only 1 "abc
" is created, can u guys confirm?
avatar
M*N
15
你不是广东人嘛

【在 A*******s 的大作中提到】
: 恩那,我们都是
avatar
g*g
16
He's wrong.

abc

【在 m*****k 的大作中提到】
: was asked this question:
: String a = "abc";
: String b = "ab";
: how many strings are created, the answer from the interviewer is only 1 "abc
: " is created, can u guys confirm?

avatar
A*s
17
广东人和南大学生不兼容……?

【在 M****N 的大作中提到】
: 你不是广东人嘛
avatar
s*e
18
I think it should be like this:
two string objects in heap (str1 and str 2).
one string literal in string pool (I do not think that spec ahs ever stated
it must be in perm gen, but highly possible. And for hotspot, i think it is)
.
avatar
M*N
19
那你认识这两个歌手的吧
后来有发展吗?

【在 A*******s 的大作中提到】
: 广东人和南大学生不兼容……?
avatar
g*s
20
i think the question was:
String a = "abc";
String b = "abc";
how many strings are created, the answer from the interviewer is only 1 "
abc" is created.

abc

【在 m*****k 的大作中提到】
: was asked this question:
: String a = "abc";
: String b = "ab";
: how many strings are created, the answer from the interviewer is only 1 "abc
: " is created, can u guys confirm?

avatar
A*s
21
不认识
avatar
r*l
22
String b = "ab", not "abc".

【在 g***s 的大作中提到】
: i think the question was:
: String a = "abc";
: String b = "abc";
: how many strings are created, the answer from the interviewer is only 1 "
: abc" is created.
:
: abc

avatar
wh
23
噢,很牛。以前听说南大差不多是南方最好的学校了,很多方面的指数都超过复旦。

【在 A*******s 的大作中提到】
: 恩那,我们都是
avatar
g*s
24
Either madmonk remembered wrong, or the interviewer gave a wrong question.
I think the orignial question should be b="abc". Intervewer wanted to know
if the intervewee knows the "abc" is generated in perm.

【在 r*****l 的大作中提到】
: String b = "ab", not "abc".
avatar
M*N
25
what about 浙大?

【在 wh 的大作中提到】
: 噢,很牛。以前听说南大差不多是南方最好的学校了,很多方面的指数都超过复旦。
avatar
g*s
26
Let's come out another interview question:
boolean f(int x){
Integer a = x;
Integer b = x;
return a==b;
}
1. f(1) should return true or false?
2. f(1000) should return true or false?

【在 g***s 的大作中提到】
: Either madmonk remembered wrong, or the interviewer gave a wrong question.
: I think the orignial question should be b="abc". Intervewer wanted to know
: if the intervewee knows the "abc" is generated in perm.

avatar
wh
27
浙大合并以后很强,但据说内讧很厉害。南大好像校风很好,士气旺盛的感觉。不过我
都没去过,都是道听途说。我以前认识一个南大的学生,到香港中大当学生会主席,他
说毕业前没事干,在学校图书馆看了很多dvd。我很羡慕,我直到香港才开始看dvd,以
前学校根本没有,可见南大那时候就很富。

【在 M****N 的大作中提到】
: what about 浙大?
avatar
g*g
28
f(1) should be true, f(1000) not so sure, I know if
the number is big enough, it will be false.
Sync on Integer may lock the system in unexpected way,
that's all it's about.

【在 g***s 的大作中提到】
: Let's come out another interview question:
: boolean f(int x){
: Integer a = x;
: Integer b = x;
: return a==b;
: }
: 1. f(1) should return true or false?
: 2. f(1000) should return true or false?

avatar
g*s
29
for -128 to 127(or bool true/false), when autobox, JVM will reuse the same
object, just like pick a object from a pool.

【在 g*****g 的大作中提到】
: f(1) should be true, f(1000) not so sure, I know if
: the number is big enough, it will be false.
: Sync on Integer may lock the system in unexpected way,
: that's all it's about.

avatar
g*e
30
还好这个我看过,不然又挂了

【在 g***s 的大作中提到】
: Let's come out another interview question:
: boolean f(int x){
: Integer a = x;
: Integer b = x;
: return a==b;
: }
: 1. f(1) should return true or false?
: 2. f(1000) should return true or false?

avatar
q*9
31
re

【在 g***s 的大作中提到】
: i think the question was:
: String a = "abc";
: String b = "abc";
: how many strings are created, the answer from the interviewer is only 1 "
: abc" is created.
:
: abc

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。