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

后端 未结 7 1396
误落风尘
误落风尘 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:02

    The primitive data types are required because they are the basis of every complex collection.

    long, double, byte etc. are used if you need only a small integer (or whatever), that does not waste your heap space.

    I know, there's enough of RAM in our times, but you should not waste it.

    I need the "small ones" for database and stream operations.

提交回复
热议问题