What is the difference between an int and an Integer in Java and C#?

前端 未结 26 1871
生来不讨喜
生来不讨喜 2020-11-22 12:00

I was reading More Joel on Software when I came across Joel Spolsky saying something about a particular type of programmer knowing the difference between an i

26条回答
  •  清歌不尽
    2020-11-22 12:42

    In Java, the int type is a primitive data type, where as the Integer type is an object.

    In C#, the int type is also a data type same as System.Int32. An integer (just like any other value types) can be boxed ("wrapped") into an object.

提交回复
热议问题