AJPFX关于modifier总结
修饰符总结 Modifiers
函数修饰符始终在返回值类型之前!!!
变量修饰符始终在变量类型之前!!!
--------------------------------------------------------------------------------
ClassModifier: one of
Annotation public protected private
abstract static final strictfp
外部类: 不可被 protected, private, static 和 final 修饰
成员内部类: 都可以
非成员内部类: 都不可以
FieldModifier: one of
Annotation public protected private
static final transient volatile
MethodModifier: one of
Annotation public protected private
abstract static final synchronized native strictfp
ConstructorModifier: one of
Annotation public protected private
InterfaceModifier: one of
Annotation public protected private
abstract static strictfp
VariableModifier: one of
Annotation final
--------------------------------------------------------------------------------
class field method constructor interface variable
Annotation √ √ √ √ √ √
public/protected/private √ √ √ √ √ ×
abstract/strictfp √ × √ × √ ×
static √ √ √ × √ ×
final √ √ √ × × √
transient/volatile × √ × × × ×
synchronized/native × × √ × × ×
--------------------------------------------------------------------------------
Annotation
以上都可以
public/protected/private
权限修饰符, 除了 variable 都可以 ->常考
abstract/strictfp
class/interface/method
static
除了 constructor 和 variable 都可以 -> 常考
final
除了 constructor 和 interface 都可以
transient/volatile
只能修饰 field
synchronized/native
只能修饰 method
--------------------------------------------------------------------------------
final 与 abstract 是冲突的.
--------------------------------------------------------------------------------
/*
包与包之间成员和构造器的访问权限总结:
public protected 无修饰符 private
同一个类中 ok ok ok ok
同一个包中 ok ok ok
不同包子类 ok ok
不同包中 ok
不同包成员访问的前提: 被访问的类必须是 public, 且被访问的成员也必须是 public 的
不同包中的子类还可以直接访问父类中 protected 的成员和构造器
不同包访问, 有2层权限限制:
第1层是类的权限限制, 类的权限可以是 public/无权限修饰符2种
第2层是成员的权限限制, 成员的权限可以是 public/protected/无权限修饰符/private 等4种
必须类的权限允许访问, 才考虑成员的权限是否允许访问!!!
实际编程中, 访问的类一般都是不同包的:
类是 public 的, 构造器是 public 的,
允许被不同包的类创建对象; 否则禁止被不同包的类创建对象
类是 public 的, 构造器是 protected 的
只允许被不同包的类继承(就是设计来被继承的, 此时不允许被不同包的类创建对象)
类是 public 的, 构造器是 private 的(一般也是 final 的)
不允许被创建对象(包括本包的类都不行), 此时一般提供 public 方法获取类的对象
不同包中, protected 的作用就是限制成员和构造器只能被子类访问;
同一包中, protected 修饰成员变量和构造函数时没任何作用, 修饰成员函数时仅仅限于覆盖.
*/
AJPFX关于modifier总结的更多相关文章
- [转]Java反射之如何判断类或变量、方法的修饰符(Modifier解析)
Java针对类.成员变量.方法,有很多修饰符,例如public.private.static.final.synchronized.abstract等,这些修饰符用来控制访问权限或其他特性. 本文就用 ...
- jmeter 中的 HTTP URL Re-writing Modifier
URL rewriting modifier,因为tomcat的session实现不是通过cookie的,而是通过session id的,就是说,用户登录有了session之后,tomcat就会维护一 ...
- 【转载】#273 - Parameter Modifier Summary
Here's a summary of the different parameter modifiers and how the behavior changes for each, when us ...
- 解决Deprecated: preg_replace(): The /e modifier is deprecated, use
使用php5.5运行ecshop的时候出现如下错误Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace ...
- 7.modifier插件的自定义和使用
1.在plugins下面创建一个文件 modifier.changeDate.php 编写: <?php function smarty_modifier_changeDate($utime,$ ...
- Sample Code for Qp_preq_pub.Price_request Api to Simulate an Ask for Promotion Modifier
DECLARE p_line_tbl QP_PREQ_GRP.LINE_TBL_TYPE; p_qual_tbl QP_PREQ_GRP.QUAL_TBL_TYPE; p_line_attr_tbl ...
- java反射(java.lang.reflect)---java.lang.reflect.Modifier中状态码
1. 详情请看jvm(虚拟机)规范 java.lang.reflect.Modifier public static final int ABSTRACT 1024 public static fin ...
- An entry point cannot be marked with the 'async' modifier
I copied below code from this link.But when I am compiling this code I am getting an entry point can ...
- AJPFX简述:MetaTrader 4移动交易平台
(AJPFX)移动交易平台可以让客户随时通过客户手中的移动设备例如智能手机.PDA等管理自己帐户和进行交易.移动交易平台提供了完整的交易帐户管理分析选项,当客户无法使用台式计算机的时候,移动交易平台为 ...
随机推荐
- [C#]从URL中获取路径的最简单方法-new Uri(url).AbsolutePath
今天在写代码时遇到这样一个问题: 如何从字符串 "http://job.cnblogs.com/images/job_logo.gif" 中得到 "/images/job ...
- 2016/2/29 html 思维导图
- Koa2学习(五)中间件
Koa2学习(五)中间件 Koa2通过app.use(function)方法来注册中间件. 所有的http请求都会依次调用app.use()方法,所以中间件的使用顺序非常重要. 中间件的执行顺序 官方 ...
- Semantic Parsing(语义分析) Knowledge base(知识图谱) 对用户的问题进行语义理解 信息检索方法
简单说一下所谓Knowledge base(知识图谱)有两条路走,一条是对用户的问题进行语义理解,一般用Semantic Parsing(语义分析),语义分析有很多种,比如有用CCG.DCS,也有用机 ...
- BootstrapValidator demo
source:http://bv.doc.javake.cn/api/ BootstrapValidator is the best jQuery plugin to validate form fi ...
- Lightoj 1003 - Drunk(拓扑排序)
One of my friends is always drunk. So, sometimes I get a bit confused whether he is drunk or not. So ...
- 比特币客户端bitcoind的高级用法
Bitcoin 比特币官方客户端有两个版本:一个是图形界面的版本,通常被称为 Bitcoin(首字母大写),以及一个简洁命令行的版本(称为 bitcoind).它们相互间是兼容的,有着同样的命令行参数 ...
- mac多线程下载神器
本文参考:https://blog.csdn.net/orangleliu/article/details/46834429 神器:axel 安装(已经安装homebrew前提下,没有请参考:http ...
- 并不对劲的hdu4777
Long long ago, there was an ancient rabbit kingdom in the forest. Every rabbit in this kingdom was n ...
- Code Project精彩系列(转)
Code Project精彩系列(转) Code Project精彩系列(转) Applications Crafting a C# forms Editor From scratch htt ...