Home  >  Article  >  Java  >  Summary of Java's four and eight basic data types

Summary of Java's four and eight basic data types

巴扎黑
巴扎黑Original
2017-08-01 11:32:262175browse

The first type: logical boolean

The second type: text type char

The third category: integer type (byte, short, int, long)

char type occupies 2 bytes
short from -32768 to 32767
int from -2147483648 , to 2147483647, a total of 10 digits
long from -9223372036854775808 to 9223372036854775807, a total of 19 digits

#The fourth category: floating point type ( float, double)

In mathematics, there are countless floating-point numbers from 0 to 1; and computers are discrete, so there are errors in representation. Computers use precision (a few decimal places to represent the correct number), which is more floating-point. When counting points, a==0.1 is inappropriate, it should be a-0.1==0; if a is 0.1, even if there is an error a-0.1==0 because both a and 0.1 are represented as an errory computer binary

The above is the detailed content of Summary of Java's four and eight basic data types. 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