Learning notes the valid range of permissions in--java

Source: Internet
Author: User

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/82/2E/wKioL1dNmemiIxJeAAAwTXZXC58621.png "title=" Java permissions scope. png "alt=" Wkiol1dnmemiixjeaaawtxzxc58621.png "/>

The point here is that the permissions of the default and Protection permissions (protected) are categorized in detail, and the parent and subclass packages differ.



To: direct the handle class into the other package (friendly is the default permission)

650) this.width=650; "src=" Http://my.csdn.net/uploads/201205/22/1337652149_2109.png "alt=" 1337652149_2109.png "/ >




The test is as follows: Note: Where the test class is the testing class, the package is the current package


Project Catalog:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/82/30/wKiom1dNohOxxIDFAABla5xwqQk743.png "style=" float: none; "title=" directory. png "alt=" Wkiom1dnohoxxidfaabla5xwqqk743.png "/>



Test of the Animal class

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/82/30/wKiom1dNohXBFlciAABN_7wCajc091.png "title=" the same package class, No parent-child relationship. png "style=" Float:none; "alt=" Wkiom1dnohxbflciaabn_7wcajc091.png "/>




Testing for Cat Classes

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/82/2E/wKioL1dNoxGzb36VAAA8yBGGbOs446.png "style=" float: none; "title=" Untitled. png "alt=" Wkiol1dnoxgzb36vaaa8ybggbos446.png "/>


Test of the Person3 class

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/2E/wKioL1dNoxHgCwCdAAA521zXPko440.png "title=" Untitled 2.png "style=" Float:none; "alt=" Wkiol1dnoxhgcwcdaaa521zxpko440.png "/>



Test of the Cat2 class

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/30/wKiom1dNohTBeAoYAAA26VsHH3E692.png "style=" float: none; "Title=" Untitled 1.png "alt=" Wkiom1dnohtbeaoyaaa26vshh3e692.png "/>




Test of the Person class

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/2E/wKioL1dNoxLBZbFWAAA8EvQUJO8304.png "style=" float: none; "Title=" Untitled 4.png "alt=" Wkiol1dnoxlbzbfwaaa8evqujo8304.png "/>


Test of the Person1 class

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/82/30/wKiom1dNohSQFkhcAAAxmnEawg4694.png "title=" Untitled 3.png "style=" Float:none; "alt=" Wkiom1dnohsqfkhcaaaxmneawg4694.png "/>


Learning notes the valid range of permissions in--java

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.