Access modifier (access modifier)

Source: Internet
Author: User
Tags modifier

Access modifier (access modifier)

1) Public: the properties and methods that are modified by publicly can be accessed by all classes

2) protected (Protected): properties and methods that are modified by protected can be accessed within the class, the same package, and the subclasses of the class.

3) Private (private): properties and methods that are modified by private can only be used inside that class.

4) Default (without any access modifiers): Used inside the class and in classes under the same package.


Instanceof: Determines whether an object is an instance of a class.

Form: Reference name instanceof class name (interface name), returns a Boolean value


This article is from the "Java" blog, so be sure to keep this source http://5737386.blog.51cto.com/5727386/1661674

Access modifier (access modifier)

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.