What is the purpose of long, double, byte, char in Java?

后端 未结 7 1364
误落风尘
误落风尘 2020-12-22 19:24

So I\'m learning java, and I have a question. It seems that the types int, boolean and string will be good for just about everything I

相关标签:
7条回答
  • 2020-12-22 20:09

    It's relative to the data you're dealing with. There's no point using a data type which reserves a large portion of memory when you're only dealing with a small amount of data. For example, a lot of data types reserve memory before they've even been used. Take arrays for example, they'll reserve a default amount (say, 256 bytes <-- an example!) even if you're only using 4 bytes of that.

    See this link for your answer

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