Java modifier Summary

Source: Internet
Author: User

Class Modifier

Public

Can be accessed from other classes

Obstract

This class cannot be instantiated

Final

Sub-classes cannot be declared.

 

Constructor Modifier

Public

Accessible from all classes

Protected

It can only be accessed from its own class and its subclass

Private

Can only be accessed in this class

 

Domain Modifier

Public

Accessible from all classes

Protected

It can only be accessed from the current class and its subclass

Private

You can only access it from this class.

Static

Only one domain value exists for all instances of this class.

Transient

Not a part of an object's persistent state

Volatile

Can be modified by asynchronous threads

Final

It must be assigned an initial value and cannot be modified.

 

Local variable Modifier

Final

It must be assigned an initial value and cannot be modified.

 

Method Modifier

Public

It can be accessed from all classes

Protected

It can only be accessed from this class and its subclass

Private

You can only access it from this class.

Abstract

No method body. It belongs to an abstract class.

Final

Subclass cannot overwrite it

Static

Instance bound to the class itself, not the class

Native

This method is implemented by other programming languages.

Asnchronized

Before a thread calls it, you must add

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.