编程知识 cdmana.com

Java basic types

8 The big basic type

Java Basic types are used very often , They were not created by new Keyword generated . Usually new All objects are stored in the heap , It's not cost-effective to create small, simple variables in this way . So for the creation of these basic types ,Java Take and C/C++ The same strategy : Don't use new establish , Use a variable to store directly value, Juxtaposed in stack memory , So it's more efficient .

Java Determine the memory footprint of each basic type .

<.........
Basic types size minimum value Maximum Packaging type
Boolean true/false - - Boolean
char 16 bits Unicode 0 Unicode 216 -1 Character
byte 8 bits -128 +127 Byte
short 16 bits -215 +215 -1 Byte
int 32 bits -231 +231 -1 Integer
long 64 bits -263 +263 -1 Long
float 32 bits IEEE754

版权声明
本文为[Irving the procedural ape]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201225140309598d.html

Scroll to Top