Java knowledge learned by 16.10.16

Source: Internet
Author: User
Tags modifiers

1.

Each byte is eight bits, so the range of values for each byte is -128~127, which can hold an English character, including letters, numbers, and punctuation. The number of Chinese characters, a byte can not be expressed in all Chinese characters, so the Chinese characters are two bytes to store. The char in Java is two bytes, so it can be used to save a Chinese character.

2.

Final is used to define constants, what is the difference between constants and variables, constants are impossible to modify, and variables can be changed in the program.

For example: Final int const=10;//Note that every letter of a constant has to be capitalized.

3.

Example: Float num=3. 14159//It's wrong to use this.

Example: Float num=3. 14159f//Add an F to the back.

Float num=3. 14159F//Add an F to the back.

Since 3. 14159 This floating-point type, the system will default to double type, in order to distinguish, can only be added in the following F or F to distinguish.

4.

Final-modified things are not allowed to be modified, and final-decorated classes are not allowed to have subclasses.

5.

Local variables cannot be decorated with modifiers. (Modifiers are: public,private,protected)

Java knowledge learned by 16.10.16

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.