[Crazy Java Handout] data type

Source: Internet
Author: User

The float must contain a decimal point.

Float Type value must be followed by a "f/f", otherwise the default is a double type.

Three special floating-point numbers:

Positive_infinity: Zheng Infinity

Negative_inifinity: Negative Infinity

NaN: Non-number

( only the floating-point number is divided by 0 to get Infinity , and the integer divided by 0 throws an exception )

Java does not enforce the amount of space occupied by a Boolean variable,

Although the Boolean type is as long as 1 bits, the computer allocates memory when the smallest memory unit is 1 bytes .

Automatic type conversion: Small number of tables can be directly assigned to a large range of table

Forced type conversions: large range of tables requires strong transfer value to a small range of table numbers

When a program uses a string literal for the first time, Java uses a constant pool to cache it.

The next time you need to use it, find it directly from the constant pool. (that is, the same literal reference is equal)

(Chang is determined during compilation and saved in A. class file)

(String type is immutable and cannot be changed once created)

The remainder operation allows the operand to be a floating-point number, and the second operand to be 0 or 0.0, and the result is Nan.

>>> unsigned right-shift operator.

The value of a Boolean variable cannot be compared with the value of any other type of variable.

int[] is a data type (reference type) , its definition, type conversion, etc. are not different from other common types.

It is not possible to allocate only the memory space for an array without assigning a value. (At least the system itself assigns a value to the array)

The array name is just a reference and can point to any valid memory.

The array name is placed in the stack memory, and the array elements are placed in the heap memory.

Each method executes with its own memory stack, and the memory stack is destroyed after the method executes.

Objects in the program are placed in the heap (because object creation costs are large) and can be reused.

You can assign a value of NULL to the array, cut off the connection between the array reference variable and the actual array, and let the latter be garbage collected.

The Parallelsort () method sorts the array, which is commonly used for multi-CPU machines.

[Crazy Java Handout] data type

Related Article

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.