Java Fundamentals (ii) data types

Source: Internet
Author: User

Tag: Encode a false constant logical short unit double 32 bits

First, the data type

Java is a strongly typed language, which means that one type must be declared for each variable. In Java, there are 8 basic types, of which 4 are integers, 2 floating-point types, 1 character types used to represent Unicode-encoded character cells, char, and 1 Boolean types used to represent truth values.

1. Integral type

BYTE 8-bit 1-byte

Short 16-bit 2-byte

int 32 bit 4 byte

Long 64-bit 8-byte

2. Floating-point type

Float 32-bit 4 bytes

Double 64-bit 8-byte

3.char type

The char type is originally used to represent a single character. Today, Unicode characters can be described with a char value, for example ' A ' is a character constant corresponding to the encoded value of 65. Some special escape characters can also be represented.

4.boole type

The Boolean type has two values: false and True, which are used to determine the logical condition. An integer value and a Boolean value cannot be converted to and from each other.

  

Java Fundamentals (ii) data types

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.