Anyone using short and byte primitive types, in real apps?

后端 未结 15 3258
遥遥无期
遥遥无期 2021-02-20 08:09

I have been programming in Java since 2004, mostly enterprise and web applications. But I have never used short or byte, other than a toy program just to know

15条回答
  •  旧时难觅i
    2021-02-20 08:24

    Until today I haven't notice how seldom I use them.

    I've use byte for network related stuff, but most of the times they were for my own tools/learning. In work projects these things are handled by frameworks ( JSP for instance )

    Short? almost never.

    Long? Neither.

    My preferred integer literals are always int, for loops, counters, etc.

    When data comes from another place ( a database for instance ) I use the proper type, but for literals I use always int.

提交回复
热议问题