The basic data type of Java Foundation Comprehensive parsing _java

Source: Internet
Author: User

Basic data type:

First, the numerical type

1) Integer:

1, byte byte, 8 bit, value range 0~255, for storing binary data.
2, short two bytes, 16 bits, the value range is between -32768~32767.
3, int four bytes, 32 bits, the value range is between -2147483648~2147483648
4, long eight bytes, 64 bits, with a value range of-9,223,372,036,854,775,808 ~9,223,372,036,854,775,807

2) Floating-point type:

1, float, four bytes, single-precision floating-point number, range of -2^128
~ +2^128
2, double, eight-byte double-precision floating-point number, range is -2^1024
~ +2^1024

Character type: Char, a set of data

Three, Boolean: Boolean, only two values, one true, one false

Four, Strings: string,

Basic Data type conversions:

Low-level to advanced can be automatically converted
Char→int→long→float→double
Byte→short→int

Forced conversions
Double num1=78.2;
int num2= (double) num1

The above basic data type of Java Foundation is a comprehensive analysis of the small series to share all the content, I hope to give you a reference, but also hope that we support the cloud habitat community.

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.