Java Learning notes-identifiers, data types, floating-point numbers, character types, booleans, type conversions

Source: Internet
Author: User

Identifier:

Start with a letter, underscore (_), dollar sign ($)

You cannot use keywords

Case sensitive

You can divide int a = 1_0000_0000_1121 with an underscore;

Data type:

int defaults to decimal, octal starts with 0, Hex starts with 0x

SYSTEM.OUT.PRINTLN (*) Default output decimal

* at Integer.tobinarystring ()-and binary; octal (octal); Hex (hex)

If the size of the data does not exceed Byte/char/short's stated range, it can be automatically transformed ☆1

Long int constant at the end plus L

Floating point number:

Floating-point constants default double, turn float at the end plus F

There are rounding errors, such as the need for high precision error-free, using the BigDecimal class; Long->biginteger

Character type:

Because Java uses Unicode, it allows you to assign a Chinese character to a char variable

Strings string

Boolean:

Boolean

Type conversions:

☆1

Binary operations Generate type promotion

Java Learning notes-identifiers, data types, floating-point numbers, character types, booleans, type conversions

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.