我写了下面的代码,并输出I想到的是“你好世界”自动装箱在哈希表返回NULL
我得到空,可以将某些人解释的行为。
import java.util.*;
public class Test {
static HashMap<Integer,String> hm = new HashMap<Integer, String>();
public static void main(String args[]) {
byte b = 1;
hm.put(1, "Hello World");
String s = hm.get(b);
System.out.println("The result is: " + s);
}
}