# 这几天在看hashcode的代码但是搞不清楚有一个问题
在hashcode中有一个判断if (h == 0 && value.length > 0)
if (h == 0 && value.length > 0) {
char val[] = value;
for (int i = 0; i < value.length; i++) {
h = 31 * h + val[i];
}
hash = h;
}
return h;
在该类的最上面并没有初始化value该成员变量
private final char value[];
Cache the hash code for the string
private int hash;
// Default to 0
但是在运行中我发现该变量默认变成了"java.lang.InternalError"字符数组
我也debug了确实如此
左边为debug的流程链
希望各位大佬解决这个wen'ti