Data type conversions in Java

Source: Internet
Author: User

The 1.Java data types fall into three main categories

Boolean, type and numeric

The numerical type is also divided into integral type and floating point type.

Variable type of 2.Java

Boolean-Type Boolean

Character Char

Integral type Byte,short,int,long

Floating-point float,double

3. Data type Conversion

Data type conversions in Java are divided into three types, simple data type conversions, strings and other type conversions, and other useful data type conversions

(1) Simple data type conversion

In Java, Integer, real, and character types are considered simple data type.

These types are from low to High: (Byte,short,char), int---Float

    from low-level variables to advanced variables that is automatic type conversion, from advanced variables to low-level variables that is forced type conversion , wrapper class transition type conversion

(2) Low-level variables can be converted directly to advanced variables

such as: Byte B;

int i=b;

float f=b;

If the low-level type is char, the conversion to the advanced type (int) is converted to the corresponding ASCII code value.

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.