Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What are data types in JAVA? Why do you want to divide data into different data types?
What are data types in JAVA? Why do you want to divide data into different data types?
Int, char, short, long, float, double, byte and Boolean in java are the basic data types in 8.

So why divide it into different data types? Because in the practical application of java, many variables are different and have their own characteristics. Need to be divided into different data types. Then this is also in line with the object-oriented characteristics of java.

Simple, such as 3> We use Boolean variables to describe this result concisely. For example, we want to represent a value 100, and we choose byte. What about double? It can also be expressed, but the system overhead of double is much higher. Then, when the number represented is relatively large or variables that need to be expressed very accurately are used, dobuble will be used exclusively.

To sum up, why JAVA should be divided into different data types, just like vehicles should be divided into cars, planes and ships, because they have their own characteristics and are suitable for different places. We can choose the model according to different needs.