Is int an object in Java?

前端 未结 4 1356
旧时难觅i
旧时难觅i 2020-12-19 00:26

More precisely, is int a part of the Integer class (a stripped down version or something) or is it something else entirely?

I am aware that int is a value type and I

4条回答
  •  星月不相逢
    2020-12-19 00:58

    • The basic types in Java are not objects and does not inherit from Object.

    • Since Java 1.5 introduced allowed auto boxing between int and Integer(and the other types).

    • Because ints aren't Objects that can't be used as generic type parameters eg the T in list

提交回复
热议问题