In the data type
One byte equals 8 bits, one byte equals 256 digits, that is 128 to +127 total 256
Numeric type
Integral type
Java integer types have a fixed number of table ranges and field lengths, and are not affected by the specific operating system to ensure the portability of Java programs.
Byte is 1 bytes, valid bit 8 bit, range-128 ~ +127
Short is 2 bytes, valid bit 16 bit, range-32768 ~ +32767
int accounts for 4 bytes, valid bit 32 bits, range -2^31 ~ +2^31-1
Long is 8 bytes, valid bit 64 bit, range -2^63 ~ +2^63-1
Floating point Type
Java floating-point types have a fixed number of table ranges and field lengths. As with integer types, in Java, the range of the character points type is machine independent.
Float occupies 4 bytes, valid bit 32 bit, range -3.403e38~3.403e38
Double is 8 bytes, valid bit 64 bit, range -1.798e308~1.798e308
Character type
Char takes 1 bytes, is a valid bit 8 bits,
Boolean type
Boolean
Citation of
Classes: Class
Interface interface
Array
Three representations of the Java-language integer constants: decimal, 12,0
Octal, beginning with 0, 012
Hex, beginning with 0x, 0x12
Java-language integer constants default to int
There are two types of representations of Java floating-point type constants: decimal must contain decimals, 3.14 scientific notation, 3.14e2java floating-point constants are double by default, and if you want to declare a constant float, you need to add F or F to the number such as: double d = 3.14; float i = 3.14f conversion of various integer data types:
(Byte, short chart int long) operation with float, output float type
Integer and real type operation, converted to real type
Byte,short, double, int, and long, the result is a long type
Byte, short, chart, and integer (int) =>int integral type
Byte, short, chart each other (byte, short, chart), the result is int
s++ operations can be performed, and single-mesh operations do not change the type of operands
j+=1; equal to j=j+1;
j*=5+6*b; equals j= j* (5+6*b) Reverse Polish style
The compound assignment operation in binocular does not change the type of computation.
Java data types and conversion rules