Java Modifiers
Private means this could only be seen within this class.
Protected means "package private", this could be seen by subclasses and package members.
| Class | Package | Subclass | Subclass | World
| | |(same pkg)|(diff pkg)|
————————————+———————+—————————+——————————+——————————+————————
public | + | + | + | + | +
————————————+———————+—————————+——————————+——————————+————————
protected | + | + | + | + | o
————————————+———————+—————————+——————————+——————————+————————
no modifier | + | + | + | o | o
————————————+———————+—————————+——————————+——————————+————————
private | + | o | o | o | o + : accessible
o : not accessible
Java Modifiers的更多相关文章
- <java基础学习>RE 基础语法(2)
Java Modifiers(java修饰符): Like other languages, it is possible to modify classes, methods, etc., by u ...
- Java Interview Reference Guide--reference
Part 1 http://techmytalk.com/2014/01/24/java-interview-reference-guide-part-1/ Posted on January 24, ...
- Java 修饰符顺序问题
What is a reasonable order of Java modifiers (abstract, final, public, static, etc.)? http://stackov ...
- Scala入门指南与建议
最近在学习使用Scala语言做项目,感觉这门语言实在是太优美了!作为一个本科数学.研究生机器学习专业的混合人才(哈哈),这门语言真的是满足了普通计算机编程(告诉计算机怎么做)和函数式编程(告诉计算机做 ...
- Spark案例分析
一.需求:计算网页访问量前三名 import org.apache.spark.rdd.RDD import org.apache.spark.{SparkConf, SparkContext} /* ...
- Java反射操作成员变量 Class can not access a member with modifiers "*"
fields[j].set(obj, val); 报: Exception in thread "main" java.lang.IllegalAccessException: C ...
- java.lang.IllegalAccessException: Class XX can not access a member of class XXX with modifiers "private static"
当前需求: 利用反射获取某一属性值运行结果:java.lang.IllegalAccessException: Class com.example.demo.test.Reflect can not ...
- java.lang.IllegalAccessException: Class XXXcan not access xxx with modifiers "private"
field 或者 method 是 provate的 field.setAccessible(true); method.setAccessible(true); 有时候是因为 newinstance ...
- Java学习之反射机制及应用场景
前言: 最近公司正在进行业务组件化进程,其中的路由实现用到了Java的反射机制,既然用到了就想着好好学习总结一下,其实无论是之前的EventBus 2.x版本还是Retrofit.早期的View注解框 ...
随机推荐
- 初识Modbus TCP/IP-------------C#编写Modbus TCP客户端程序(一)
转自:http://blog.csdn.net/thebestleo/article/details/52269999 首先我要说明一下,本人新手一枚,本文仅为同样热爱学习的同学提供参考,有不 对的地 ...
- poj1845(二分快速求等比数列模M和)
Sumdiv Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 17039 Accepted: 4280 Descripti ...
- SELinux状态修改
查看SELinux状态: 1./usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态 SELinux status: ...
- 九度OJ 1184:二叉树遍历 (二叉树)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:3515 解决:1400 题目描述: 编一个程序,读入用户输入的一串先序遍历字符串,根据此字符串建立一个二叉树(以指针方式存储). 例如如下的 ...
- Cordova+FrameWork7开发简单教程
1: 环境要有:(一个不会搭建环境的程序员,要么学,要么退出编程 ) 环境这里我只说需要什么: 1>AndroidStudio 3.0 (2.几的版本总会出问题.我喜欢用新版本) 2>co ...
- centos 下安装pdo_pgsql 只需一个命令_______yum install php56w-pgsql
[root@localhost ~]# yum install php56w-pgsql Loaded plugins: fastestmirror, langpacks Repository pgd ...
- centos 6.5 编译安装了 Nginx1.6.0+MySQL5.6.19+PHP5.5.14
centos 6.5 编译安装了 Nginx1.6.0+MySQL5.6.19+PHP5.5.14--------------------------------------------------- ...
- swift 全局常量 && 全局变量的写法
在OC里面 如果 想设置一个全局常量 很简单 使用简单宏定义 就搞定了 例如: #define WEBAPIBASEURL @"http://www.baidu.com/" ...
- c的详细学习(5)数组
到目前为止,前面介绍的都是属于基本类型的数据.除此之外,C语言还提供了一些更为复杂的数据类型,称为构造类型.数组就是最基本的构造类型.若要针对一批数据进行某种操作,采用数组是一种方便可行的方法 ...
- 【leetcode刷题笔记】Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, ...