在原始数据类型的变量上使用.运算符时,该变量将自动装箱,例如: var str = "Hello World"; // str is of type string
console.log(str.length); // a temporary object of type String will be created 但是,自动装箱是否仅在使用.操作符
public class P { return "P.m(int)"; return "P.m(Object)";}
public static void main(String[] args) { System.out.println(p.m(Integer.valueOf(42)));}
我不明白为什么这个程序打印"P.m(Obj