Is int an object in Java?

前端 未结 4 1358
旧时难觅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 01:03

    Primitive types aren't objects, but are stored directly in whatever context they are needed. If they need to be treated like an object, they can be boxed in an Integer.

提交回复
热议问题