Using int vs Integer

后端 未结 9 1497
抹茶落季
抹茶落季 2020-12-01 01:28

I came across a class using Integer variables to capture size to be used in a for loop. Is this good practice or should we use the int primitive data type?

I         


        
9条回答
  •  北荒
    北荒 (楼主)
    2020-12-01 02:00

    Promote primitive types always where it is possible.

    primitive types can not be used as GenericArgument or a null.

提交回复
热议问题