Java is a strongly typed language.
Java has a total of 8 basic types, of which 4 are shaped, 2 floating-point types, 1 are used to represent Unicode-encoded character cells, char and 1 are used to represent true and false Boolean types.
integer : In Java, the scope of the shaping is independent of the machine running Java code--addressing cross-platform, different-digit operating system issues.
Int:4 byte -2147483648~2147483647 ( just over 2 billion )
Short:2 bytes -32768~32767
Long:8 byte Very Large
Byte:1 bytes -128~127
1 normally the int is sufficient.
2 Long integer has a suffix l
3 Note Java does not have any unsigned type (unsigned type)
float type : float 4 bytes
Double 8 bytes
1 in most cases the double type is used, and the precision of the float type is difficult to meet
2 float type suffix f
3 floating-point value without suffix f (for example, 3.402) defaults to double type
4 Double type suffix D
Interesting thing: System.out.println (2.0-1.1); will print 0.8999999999999999 instead of 0.9 of people's imagination. The main reason is that the floating-point value is represented by a binary system, and the fractional 1/10 is not accurately represented in the binary system. So you need to use the BigDecimal class without error.
Java Data types