1. Basic types: long, int, byte, float, double, char.
2. Object type (class): long, integer, byte, float, double, char, string, all other classes provided or created by java.
Among them, Long is also called the wrapper class of long. Bytes and floating points are similar. Usually, the name of a packaged class begins with the capital letter of a numeric name.
In java, sometimes operations must be performed between two class objects, and operations between objects and numbers are not allowed. So there needs to be an object that wraps the numbers so that it can operate with another object.
For example, we can also define a class:
Class leader {
int I = 0;
public Long (int i){
this.i = i
}
}
So this integer is a wrapper class, wrapping an integer value, and then you can write some operator overloaded methods in it to support some operations. At this point you can assign a value:
Long it = new long (10);
Now the variable it is an object, not a number.
Long is a long integer, no matter how long it is. The plastic part of 12. 10 is 12. Of course, the result is 12.
Byte: an eight-bit integer-128- 127, which can be used to save memory.
Short name: 16-bit integer -32768-32767, which also saves memory.
Int: 32-bit integer -2,147,483,648-2,147,483,647, generally speaking, integers are enough.
Long: 64-bit integer-9,223,372,036,854,775,808-9,223,372,036,854,775,807, which is generally unnecessary.
Floating-point type: 32-bit floating-point type, please use it if floating-point type needs to save memory.
Double: 64-bit floating point, generally suitable for non-integer floating point.