Java based: eight basic data types, value ranges and store byte instructions.

Java, a total of eight basic data types:

4 kinds integer: int, short, long, byte.

Two kinds of floating-point type: float, double.

One kind of character types: char.

Type one kind represented true value: boolean.

[String is not a primitive data types. Learn C language students should know that the string is actually a char array]

 

For these data types, the most important thing is to know about their ranges, so that the actual definition of them, only without error.

 Integer and floating-point value range:

 Types of Byte length   Ranges
int  4 bytes  -2 147 483 648 ~ 2 147 483 647
short 2 bytes   -32 768 ~ 32 767
long  8 bytes  -9 223 372 036 854 775 808 ~ 9 223 372 036 854 775 807
byte  1 byte   -128 ~ 127
float 4 bytes About ± 3.402 823 47E + 38F (6 ~ 7 significant digits)
double  8 bytes  About ± 1.797 693 134 862 315 70E + 308 (15 significant digits) 

 

char type

char type value to use single quotes, such as: 'A'.

Note: "A" and 'A' is not the same. "A" is a string of length 1, which this test, often appear.

 

boolean type

Only two types of boolean values: false and true, the logic used to determine the conditions.

Note: Integer and Boolean type can not be converted. In C or C ++ species, number of non-zero may represent true, may represent the number 0 false.

So in Java among the logical conditions can only be false or true. If you enter a number, not by compilation.

 

Guess you like

Origin www.cnblogs.com/lbhym/p/11122716.html