Referrence: Oracle Java Doc

Two levels

top level: public, or package-private (no explicit modifier)

member level: public, private, protected, package-private (no explicit modifier)

Three Modifiers & Four Access Control Types

1. public

A class/ member may be declared with the modifier public, in which case that class is visible to all classes everywhere.

2. package-private (no explicit modifier)

If a class/ member has no modifier (the default, also known as package-private), it is visible only within its own package.

3. private

The private modifier specifies that the member can only be accessed in its own class.

4. protected

The protected modifier specifies that the member can only be accessed within its own package (as with package-private) and, in addition, by a subclass of its class in another package.

Access Levels Chart

1st col: Whether the class itself has access to the member defined by the access level.

2nd col: Whether classes in the same package as the class (regardless of their parentage) have access to the member.

3rd col: Whether subclasses of the class declared outside this package have access to the member.

4th col: Whether all classes have access to the member.

Controlling Access in Java的更多相关文章

  1. StreamSets学习系列之启动StreamSets时出现Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "test.to.ensure.security.is.configured.correctly" "read")错误的解决办法

    不多说,直接上干货! 问题详情 [hadoop@master streamsets-datacollector-]$ ./bin/streamsets dc Java 1.8 detected; ad ...

  2. java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")

    转自:https://blog.csdn.net/bluecard2008/article/details/80921682?utm_source=blogxgwz0 摘要: 今天在使用jetty做容 ...

  3. access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve")

    在开启derby服务出现该错误(测试hibernate 连接数据库时  使用myeclipse2014自带的数据库--windows->show view->other->Myecl ...

  4. 保护代理模式-Access Proxy(Java实现)

    保护代理模式-Access Proxy 保护代理模式(Access Proxy), 也叫Protect Proxy. 这种代理用于对真实对象的功能做一些访问限制, 在代理层做身份验证. 通过了验证, ...

  5. atorg.apache.hadoop.io.nativeio.NativeIO$Windows.access(NativeIO.java:557)

    错误原因: 你当前开发环境中{Hadoop_HOME}\bin\hadoop.dll 文件和你当前的hadoop版本不匹配.  解决方案: 网络下载相应版本的hadoop.dll,并将该文件放入c:\ ...

  6. windows elasticsearch使用ik分词器插件后启动报错java.security.AccessControlException: access denied ("java.io.FilePermission" "D:...........\plugins\ik-analyzer\config\IKAnalyzer.cfg.xml" "read")

    删除es安装文件夹中空格,遂解决......(哭

  7. Using Java SecurityManager to grant/deny access to system functions

    In Java it is possible to restrict access to specific functions like reading/writing files and syste ...

  8. Error updating database. Cause: java.sql.SQLException: Access denied for user '${username}'@'localhost' (using password: YES)

    导入别人的项目,出现一个错误,经过排查,是db.properties配置文件中的用户名与Mybatis-conf.xml配置文件中调用的用户名不一致所导致的 (db.properties中用的是nam ...

  9. Java程序生成一个Access文件

    package access; import java.io.File;import java.io.IOException;import java.sql.SQLException;import j ...

随机推荐

  1. nyoj201 作业题

    作业题 时间限制: 3000 ms  |  内存限制: 65535 KB 难度: 3   描述 小白同学这学期有一门课程叫做<数值计算方法>,这是一门有效使用数字计算机求数学问题近似解的方 ...

  2. 使用CMD连接SQL Server

      在CMD中操作数据库,界面不美观,而且排版不整齐,但在机器上没有安装SQLSERVER的时候,也是极其方便的.   在命令行中输入 OSQL ?可以获得所有帮助信息   osql -S 数据库服务 ...

  3. ASP.NET中在线用户统计

    统计在线用户的作用不言而喻,就是为了网站管理者可以知道当前用户的多少,然后根据用户数量来观察服务器或者程序的性能,从而可以直观的了解到网站的吸引力或者网站程序的效率.现在,我们就介绍一个简单明了的方法 ...

  4. JavaScript操作剪贴板(转)

    IE是第一个支持与剪贴板相关的事件,以及通过JavaScript访问剪贴板数据的浏览器.IE的实现成为了某种标准,不仅Safari 2.Chrome和Firefox 3也都支持类似的事件和剪贴板(Op ...

  5. 在CentoOS中安装g++ 并连接Oracle数据库

    1.安装运行环境 # yum install gcc-c++ 备注:此时会将gcc-c++和libstdc++-devel都安装上. 2.查看g++是否安装成功[root@MyRHEL 桌面]# g+ ...

  6. asp.net mvc4 远程验证

    [HttpGet] public ActionResult CheckToolsIdExists(string ToolsID) { using (BaseContext context = new ...

  7. OpenGL ES 2.0 绘制方式

    OpenGL ES 中支持的绘制方式大致分3类,包括点.线段.三角形,每类中包括一种或多种具体的绘制方式. GL_POINTS 传入渲染管线的一系列顶点单独进行绘制. GL_LINES   传入渲染管 ...

  8. hdu1054 树状dp

    B - 树形dp Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:10000KB     64bit ...

  9. Python提取图片的ROI

    图像处理经常需要提取图片的ROI,本文使用Python提取图片的ROI. 使用的Module是PIL (Pillow),一个图像处理库,用到的函数为类 Image 中的 crop 方法. 函数原型为: ...

  10. Longest Palindromic Substring -LeetCode

    题目 Given a string s,find the longest palindromic substring in S.You may assume  that the maximum len ...