我的疑问为何不是2,答案这样解释:
3) Compile time error
The wrapper classes cannot be used like primitives.
Depending on your compiler you will get an error that says someting like “Error: Can’t convert java lang Integer”. Wrapper classes have similar names to primitives but all start with upper case letters.
Thus in this case we have int as a primitive and Integer as a wrapper. The objectives do not specifically mention the wrapper classes but don’t be surprised if they come up.
但是我编译及执行的结果是2没错,我是直觉它可以autobox,所以不会错,问题真是让人费解!
