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

后端 未结 15 3304
遥遥无期
遥遥无期 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条回答
  • 2021-02-20 08:29

    It's perhaps more interesting to look at the semantics of int. Are those arbitrary limits and silent truncation what you want? For application-level code really wants arbitrary sized integers, it's just that Java has no way of expressing those reasonably.

    0 讨论(0)
  • 2021-02-20 08:31

    Keep in mind that Java is also used on mobile devices, where memory is much more limited.

    0 讨论(0)
  • 2021-02-20 08:35

    bytes and shorts are extensively used in Java Card development. Take a look at my answer to Are there any real life uses for the Java byte primitive type?.

    0 讨论(0)
提交回复
热议问题