What is the difference between Int and Integer in Kotlin?

后端 未结 3 544
遇见更好的自我
遇见更好的自我 2021-02-05 06:33

I have tried using Int and Integer types in Kotlin.Although I don\'t see any difference. Is there a difference between Int and Integer types in Kotlin?Or are they the same?

3条回答
  •  轮回少年
    2021-02-05 07:36

    A Int is a primitive Type. This is equivalent to JVM int.

    A nullable Int Int? is a boxed Type. This is equivalent to java.lang.Integer.

提交回复
热议问题