About basic data type conversions in Java

Source: Internet
Author: User

There are four basic types in Java, of which integer is divided into Byte, short, int, long, floating-point type float, double, char, Boolean. 8 Types of levels from low to high byte->short/char->int->long->float->double.

Basic data type conversions in Java are divided into implicit type conversions (automatic type conversions) and explicit type conversions (coercion type conversions).

Implicit type conversion is the assignment of a lower-level value or variable to a higher level variable, in which case Java automatically converts the lower-level variable or value to the same levels as the higher-level variable. During the period, the programmer does not need to do any action.

Explicit type conversions artificially convert a higher-level variable to a lower-class variable in the form of a value that is converted (the type to be converted). It is important to note that the loss of precision can result if an explicit type conversion is made.

About basic data type conversions in Java

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.