Basic data types for the Java Foundation

Source: Internet
Author: User

Basic data type:

First, the numerical type1) Integer:1, byte a byte, 8 bits, the 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, value range is between -2147483648~21474836484, long eight bytes, 64 bits, the value range is 9,223,372,036,854,775,808 ~9,223,372,036,854,775,8072) floating point type:1, float, four bytes, single-precision floating-point number with a range of -2^128
~ +2^128
2, double, eight-byte double-precision floating-point number with a range of -2^1024
~ +2^1024
second, character type: Char, a set of data setsThree, Boolean: Boolean, only two values, one true, one falseFour, Strings: string,Basic Data type conversions:low to advanced can be converted automaticallychar→int→long→float→doubleByte→short→intForced Conversionsdouble num1=78.2;int num2= (double) Num1

Basic data types for the Java Foundation

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.