Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the basic data types of java

Shulou Source: shulou.com Published: 2022-05-31 10:52:37 09月23日 Update

This article mainly introduces "what are the basic data types of java". In daily operation, I believe many people have doubts about what basic data types java has. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "what basic data types does java have?" Next, please follow the editor to study!

1. Integer, byte, short, int, long

Value range of byte:-128 to 127 (- 2 to-1)

The value range of short:-32768 / 32767 (- 2 to-1 / 15)

The value range of int:-21474836481147483647 (31 power of-2 to 31 power-1 of 2)

Value range of long:-92233720368547748089223372036854774807 (63 power of-2 to 63 power-1 of 2)

2. Floating point type, float, double

Both float and double represent floating-point data types, and the difference between them lies in their accuracy.

Range of values for float (single-precision floating-point type): 3.402823e+38~1.401298e-45 (eHarmony 38 is multiplied by 10 to the 38th power, while eMurray 45 is multiplied by 10 to the minus 45th power).

Value range of double (double precision floating point): 1.797693e+308~4.9000000e-324 (ditto)

3. Character type, char.

Char ch ='a character; / / can be Chinese character, because it is Unicode code char ch = 1010; / / can be decimal number, octal number, hexadecimal number, and so on. Char ch ='\ 0binary; / / can be initialized with character encoding, for example:'\ 0' indicates the Terminator, and its ascll code is 0, which means the same meaning as ch = 0.

4. Boolean type, boolean.

There are only two values: true and false.

At this point, the study on "what are the basic data types of java" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Range data type floating point learning meaning more coding help different character type practical accurate next between octal hexadecimal decimal single precision Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Redmi Huawei Microsoft Shulou Information