TIJ——Chapter Six:Access Control
package:the library unit
The levels of access control from "most access" to "least access" are public, protected, package access(which has no keyword), and private.
Each compilation unit must hava a name ending in .java, and inside the complication unit there can be a public class that must hava the same name as the file(including capitalization, but excluding the .java file name extension). There can be only one public class in each compilation unit; otherwise, the compiler will complain. If there are additional classes in that compilation unit, they are hidden from the world outside that package because they’re not public, and they comprise "support" classes for the main public class.
Java access specifiers
|_protected: inheritance access
Sometimes the creator of the base class would like to take a particular member and grant access to derived classes but not the world in general. That’s what protected does. protected also gives package access-that is, other classes in the same package may access protected elements.
Class access
倒包的一些限制:
1、There can be only one public class per compilation unit(file). The idea is that each compilation unit has a single public interface represented by that public class. It can hava as many supporting package- access as you want. If you hava more than one public class inside a compilation unit, the compiler will give you an error message.
2、The name of the public class must exactly match the name of the file containing the compilation unit, including capitalization. So for Widget, the name of the file must be Widget.java, not widget.java or WIDGET.java. Again, you’ll get a compile-time error if they don’t agree.
3、It is possible, thought not typical, to hava a compilation unit with no public class at all. In this case, you can name the file whatever you like(although naming it arbitrarily will be confusing to people reading and maintaining the code).
TIJ——Chapter Six:Access Control的更多相关文章
- [C++] OOP - Access Control and Class Scope
Access Control And Inheritance Protected Member Like private, protected members are unaccessible to ...
- In c++ access control works on per-class basis not on per-object basis.
#ifndef MYTIME_H #define MYTIME_H class MyTime { private: int m_hour; int m_minute; public: MyTime() ...
- Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' heade
XMLHttpRequest cannot load http://10.164.153.37:8050/WebService/WebService.asmx/wsGetStreetData. Res ...
- Windows Azure Virtual Network (10) 使用Azure Access Control List(ACL)设置客户端访问权限
<Windows Azure Platform 系列文章目录> 本文介绍的是国内由世纪互联运维的China Azure. 我们在创建完Windows Azure Virtual Machi ...
- SELINUX、Security Access Control Strategy && Method And Technology Research - 安全访问控制策略及其方法技术研究
catalog . 引言 . 访问控制策略 . 访问控制方法.实现技术 . SELINUX 0. 引言 访问控制是网络安全防范和客户端安全防御的主要策略,它的主要任务是保证资源不被非法使用.保证网络/ ...
- Linux VFS Extended Attribute And Access Control Table
catalog . 简介 . 扩展属性 . 访问控制表 . 小结 0. 简介 许多文件系统都提供了一些特性,扩展了VFS层提供的标准功能,虚拟文件系统不可能为所有特性都提供具体的数据结构.超出标准的U ...
- RBAC(Role-Based Access Control,基于角色的访问控制)
RBAC(Role-Based Access Control,基于角色的访问控制),就是用户通过角色与权限进行关联.简单地说,一个用户拥有若干角色,每一个角色拥有若干权限.这样,就构造成“用户-角色- ...
- 转:Oracle R12 多组织访问的控制 - MOAC(Multi-Org Access Control)
什么是MOAC MOAC(Multi-Org Access Control)为多组织访问控制,是Oracle EBS R12的重要新功能,它可以实现在一个Responsibility下对多个Opera ...
- Server-Side Access Control
Firefox 3.5 implements the W3C Access Control specification. As a result, Firefox 3.5 sends specifi ...
随机推荐
- 关于hive表同步类型问题
今天华为做实施的时候发现kylin做刷cube的时候发现源表数据类型不适合刷到kylin提供查询接口.问了下同事发现一个比较简单的解决办法. 源表是String类型,做hive视图可以做个hive表提 ...
- 入门servlet:request获取请求参数通用方式
一.获取请求参数通用方式 1. String getParameter(String name):根据参数名称获取参数值 例:username=flypig&password=2343 2. ...
- ionic4环境搭建
1.下载安装node 下载地址:https://nodejs.org/en/ 安装后,win+R输入cmd,回车运行cmd命令窗口,输入下面的命令验证node是否安装成功: 如果出现上图所示,则证明n ...
- spring源码学习之容器的扩展(一)
在前面的章节,我们一直以BeanFactory接口以及它的默认实现XmlBeanFactory为例进行解析,但是,spring还提供了另一个接口ApplicationContext,用于扩展BeanF ...
- sql作业启停服务器
IF EXISTS(SELECT * FROM msdb.dbo.sysjobs WHERE name='启用pubs数据库') EXEC msdb.dbo.sp_delete_job @job_na ...
- C# params 用法简介
params 是C#的关键字, params主要是在声明方法时参数类型或者个数不确定时使用,关于params 参数数组,需掌握以下几点: 一.参数数组必须是一维数组 二.不允许将params修饰符与r ...
- Java借助itext pdf生成固定格式pdf的模板工具类
这里是标题区域 这里是副标题1: 副标题的内容 这里是副标题2: 这里是副标题2的内容 这里是副标题3: 这里是副标题3的内容 序号 表头1 复合表头 表头2 子表头1 子表头2 子表头3 1 居左内 ...
- LINUX普通猫的拔号工具介绍
普通猫分为串口和PCI的,请查看 <关于网络设备概述 > 普通猫的拔号工具主要有kppp和wvdial:在Redhat/Fedora中,用system-config-network 或re ...
- 在虚拟机Ubuntu14.04中设置静态ip后无法上网的问题的解决
背景:用着实验室代理服务器上网. 原因:网关和DNS没有设置正确 网关和DNS参照 真机cmd在命令窗口使用ipconfig /all命令查看 虚拟机: sudo gedit /etc/netw ...
- 模拟7题解 T1方程的解
方程的解 [扩展欧几里德] 首先进行特判,两个小时基本想到了,除了a!=0,b==0,a*c<0这种情况 其次就是一般情况: 首先exgcd求出ax+by=GCD(a,b)的一组任意解 然后两边 ...