Java modifier Summary

Source: Internet
Author: User

Class Modifier
Public can be accessed from other classes
Abstract This class cannot be instantiated
Final cannot declare subclass any more

Constructor Modifier
Public can be accessed from all classes
Protected can only be accessed from its own class and its subclass
Private can only be accessed in this class

domain modifier
Public can be accessed from all classes.
protected can only be accessed from this class and its subclass.
private can only access it from this class.
static: Only one domain value exists for all instances of this class.
transient is not a part of the persistent state of an object.
volatile it can be modified by an asynchronous thread.
final must assign an initial value to it and cannot modify it.

Local variable Modifier
Final must assign an initial value to it and cannot modify it.

Method Modifier
Public can access it from all classes
Protected can only access it from this class and its subclass
Private can only be accessed from this class
Abstract: No method body. It belongs to an abstract class.
The final subclass cannot overwrite it.
Static is bound to the class itself, not the instance of the class.
Native Programming Language Implementation
Asnchronized must be added to a thread before calling it.

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.