Data type conversions for Java

Source: Internet
Author: User

There are eight basic data types in Java: byte byte, int, short, long, single-precision float, double-precision floating-point double, char Char, BOOL Boolean. There is a type conversion in these basic data types.

The implicit type conversion is to assign a data type that represents a small range to a data type that represents a large range, for example: int x = 50; Double y; Y=x

Forcing a type conversion can discard precision, and its code behaves as: int x= (int) 23.89; Long y= (long) 34.98F;

Data type conversions for 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.