Modifiers in the Java language

Source: Internet
Author: User
Tags modifier modifiers

Modifiers in the Java language

----------------------------------------------------------------------------------------------

The available modifiers for classes, methods, member variables, and local variables

Access Control Level classifications:

Exposure level, protected level, default level, private level

--------------------------------------------------------------------------------------------------

Abstract modifier:

--------------------------------------------------------------------------------------------------

Final modifier:

Final variable:

Defining constants in a program with the final modifier has the following effects:

1. Improve the security of the program, prohibit illegal modification of the value fixed and not allowed to change the data

2. Improve the maintainability of program code

3. Improve the readability of program code

-------------------------------------------------------------------------------------------------------------

static modifier:

The difference between a static variable and an instance variable:

1. Static variables have only one copy in memory, while the runtime Java Virtual machine allocates only one memory for static variables, the memory allocation of static variables is completed during the load class, and static variables can be accessed directly through the class name.

2. For instance variables, each time an instance is created, the instance variable is allocated one memory, and the instance variable can have multiple copies in memory and does not affect each other.

Modifiers in the Java language

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.