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 ...
随机推荐
- mybatis学习:mybatis注解开发一对一的查询配置
实体类: public class Account { private Integer id; private Integer uid; private Double money; private U ...
- T2485 汉诺塔升级版(普及)(递归)
https://www.luogu.org/problem/show?pid=T2485 题目背景 汉诺塔升级了 题目描述 现在我们有N个圆盘和N个柱子,每个圆盘大小都不一样,大的圆盘不能放在小的圆盘 ...
- Luogu P1530 分数化小数 Fractions to Decimals(模拟)
P1530 分数化小数 Fractions to Decimals 题意 题目描述 写一个程序,输入一个形如\(N/D\)的分数(\(N\)是分子,\(D\)是分母),输出它的小数形式.如果小数有循环 ...
- lc287 Game of Live
lc287 Game of Live 难点在于不能使用额外的空间. 观察到数组中每一个元素要么为1要么为0,32位int只用了一位,可以利用bit操作,将第二次state存储到int变量的倒数第二位中 ...
- spring源码学习之bean的加载(三)
接着二中的继续写,那个都超过1000行了,哈,需要重新写一个,要不太长了,我都看不下去了 7.4 初始化bean doCreateBean函数中有这样一行代码:这行代码中initializeBean函 ...
- [原创]iFPGA-Cable FT2232H Xilinx / Altera / Lattice 三合一JTAG & UART调试器-详细使用说明
iFPGA-Cable调试器使用说明 全文分为6部分: 第0部分:实物.连线及其驱动安装说明 第1部分:Xilinx JTAG 第2部分:UART 第3部分:Altera JTAG 第4部分:Latt ...
- css上下左右居中
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Connection reset问题,INFO: I/O exception (java.net.SocketException) caught when processing reques
困扰我多年的Connection reset问题 第一次出现:是thrift的python client去请求server,发现偶尔出现这个问题 第二次:接入第三方的api,去请求数据时,发现一个接入 ...
- CSS 教程 - 闭合浮动元素
按照CSS规范,浮动元素(floats)会被移出文档流,不会影响到块状盒子的布局而只会影响内联盒子(通常是文本)的排列. 因此当其高度超出包含容器时,一般父容器不会自动伸长以闭合浮动元素. 但是有时我 ...
- IO流2 --- File类的常用方法1 --- 技术搬运工(尚硅谷)
File类的获取功能 @Test public void test2(){ File file1 = new File("hello.txt"); File file2 = new ...