我是一个完全的新手,正在尝试学习Java。我在这里阅读了有关自动装箱
和拆箱
概念的内容(链接)。
我正在使用Java版本1.8.0_05和Eclipse。
代码如下:
class Test {
public static void main(String[] args) {
Integer iob = 100; // shows error -> Type mismatch: Cannot convert from int to Integer
}
}
感谢您的帮助。
Exception in thread "main" java.lang.Error: Unresolved compilation problem: Type mismatch: cannot convert from int to Integer at com.start.variables.Boxing.main(Boxing.java:6)
。 - Dangling Cruze