Home  >  Article  >  Java  >  How many bits does java long occupy?

How many bits does java long occupy?

coldplay.xixi
coldplay.xixiOriginal
2020-09-02 14:28:2615907browse

java long occupies 64 bits, because one byte is equal to 8 bits, so long occupies 8 bytes, which is 64 bits; for other types, float occupies 4 bytes or 32 bits, and char occupies 2 Bytes are 16 bits.

How many bits does java long occupy?

[Related learning recommendations: java basic tutorial]

java long occupies 64 bits

1. Byte: byte: a unit of measurement used to measure storage capacity; bit: bit

2. One byte is equal to 8 bits. 1byte = 8bit

Integer type:

  • ##byte: 1 byte 8 bits -128~127

  • short: 2 bytes, 16 bits

  • int: 4 bytes, 32 bits

  • long: 8 bytes 64 bits

Floating point type:

  • float: 4 bytes 32 bits

  • double: 8 bytes 64 bits

Note: The default is double type, such as 3.14 is double type, add suffix F (3.14F) is of float type.

char type:

char occupies 2 bytes and 16 bits, so a char type can store one Chinese character.

Boolean type

boolean: (true or false) (not specified how many bytes 1 byte 1 bit 4 bytes)

Related recommendations:

Programming video courses

The above is the detailed content of How many bits does java long occupy?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn