Java simple data type

Source: Internet
Author: User
Java simple data type-general Linux technology-Linux programming and kernel information. The following is a detailed description. Java defines eight simple (or basic) data types: byte, short, int, and long ), char, float, double, and boolean types can be divided into four groups:

· INTEGER: This group contains byte, short, int, and long integers, which are signed integers.
· Floating point number: This group includes float and double, which indicate numbers with decimal precision requirements.
· Character: This group contains character characters (char), which represent Character Set symbols, such as letters and numbers.
· Boolean: This group includes boolean, which is a special type that represents real/false values.
You can use them as defined, or you can construct arrays or classes to use them. In this way, they form the basis for all other types of data you may create.

A simple data type represents a single value, rather than a complex object. Java is completely object-oriented, but the simple data type is not. They are similar to other simple data types in most non-object-oriented languages. This is because of efficiency considerations. Introducing simple data types in Object-Oriented architecture does not affect execution efficiency too much.

The definition of a simple type has a clear range and mathematical characteristics. In languages such as C and C ++, the integer size varies according to the requirements of the execution environment. However, this is not true for Java. Because of Java portability requirements, all data types have a strictly defined range. For example, no matter what platform It is based on, the integer (int) is always 32 bits. Such programs can run in any machine architecture. Of course, strictly specifying the size of an integer may cause performance loss in some environments, but in order to achieve portability, this loss is necessary.

Let's discuss each type of data in sequence.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.