枚举java语言中的修饰符组合
package model;
/*22:37 2019/7/20*/ /*
top class的修饰符组合
abstract final public
2 * 2 * 2
warning:
abstract final 冲突
最终,共有2*(2*2-1)=6种修饰符组合用于top class
*/
/*
public abstract class PublicAbstractClass{}
public final class PublicFinalClass{}
abstract class AbstractClass{}
final class FinalClass{}
public class PublicClass{}
class Class{} 关于constructor的修饰符组合
abstract [DEFAULT] protected public 关于field的修饰符组合
4 * 2 * 2 * 2 * 2
权限 静态的 瞬态的 同步的
private 缺省 缺省 缺省 缺省
缺省 (not final) (not static) (not transient) (not volatile)
protected
public final static transient volatile warning:
volatile final 冲突
最终,共有4*2*2*(2*2-1)=48种修饰符组合用于field 关于method的修饰符组合
4 * 2 * 2 * 2 * 2 * 2
权限 静态的 同步的 本地的
private 缺省 缺省 缺省 缺省 缺省
缺省 (not abstract) (not final) (not static) (not synchronized) (not native)
protected
public abstract final static synchronized native
warning:
abstract 和 private 冲突
abstract 和 final 冲突
abstract 和 synchronized 冲突
abstract 和 static 冲突
abstract 和 native 冲突
所以abstract method 的修饰符组合只有三种:
abstract
protected abstract
public abstract
最终,共有4*2*2*2*2+3=67中修饰符组合用于method
*/ /**
* 这个类列举了所有的用于字段的修饰符组合
* ├构造器的修饰符组合
* └方法的修饰符组合
* @author zhangxingshuo
*/
abstract class A {
/*fields*/
/*transient and volatile*/
private transient volatile int privateTransientVolatileIntMemberField;
transient volatile int transientVolatileIntMemberField;
protected transient volatile int protectedTransientVolatileIntMemberField;
public transient volatile int publicTransientVolatileIntMemberField; // private final transient volatile int privateFinalTransientVolatileIntMemberField=0;
// final transient volatile int finalTransientVolatileIntMemberField=0;
// protected final transient volatile int protectedFinalTransientVolatileIntMemberField=0;
// public final transient volatile int publicFinalTransientVolatileIntMemberField=0; private static transient volatile int privateStaticTransientVolatileIntMemberField;
static transient volatile int staticTransientVolatileIntMemberField;
protected static transient volatile int protectedStaticTransientVolatileIntMemberField;
public static transient volatile int publicStaticTransientVolatileIntMemberField; // private final static transient volatile int privateFinalStaticTransientVolatileIntMemberField=0;
// final static transient volatile int finalStaticTransientVolatileIntMemberField=0;
// protected final static transient volatile int protectedFinalStaticTransientVolatileIntMemberField=0;
// public final static transient volatile int publicFinalStaticTransientVolatileIntMemberField=0; /*not transient and volatile*/
private volatile int privateVolatileIntMemberField;
volatile int VolatileIntMemberField;
protected volatile int protectedVolatileIntMemberField;
public volatile int publicVolatileIntMemberField; // private final volatile int privateFinalVolatileIntMemberField=0;
// final volatile int finalVolatileIntMemberField=0;
// protected final volatile int protectedFinalVolatileIntMemberField=0;
// public final volatile int publicFinalVolatileIntMemberField=0; private static volatile int privateStaticVolatileIntMemberField;
static volatile int staticVolatileIntMemberField;
protected static volatile int protectedStaticVolatileIntMemberField;
public static volatile int publicStaticVolatileIntMemberField; // private final static volatile int privateFinalStaticVolatileIntMemberField=0;
// final static volatile int finalStaticVolatileIntMemberField=0;
// protected final static volatile int protectedFinalStaticVolatileIntMemberField=0;
// public final static volatile int publicFinalStaticVolatileIntMemberField=0; /*transient and not volatile*/
private transient int privateTransientIntMemberField;
transient int transientIntMemberField;
protected transient int protectedTransientIntMemberField;
public transient int publicTransientIntMemberField; private final transient int privateFinalTransientIntMemberField=0;
final transient int finalTransientIntMemberField=0;
protected final transient int protectedFinalTransientIntMemberField=0;
public final transient int publicFinalTransientIntMemberField=0; private static transient int privateStaticTransientIntMemberField;
static transient int staticTransientIntMemberField;
protected static transient int protectedStaticTransientIntMemberField;
public static transient int publicStaticTransientIntMemberField; private final static transient int privateFinalStaticTransientIntMemberField=0;
final static transient int finalStaticTransientIntMemberField=0;
protected final static transient int protectedFinalStaticTransientIntMemberField=0;
public final static transient int publicFinalStaticTransientIntMemberField=0; /*not transient and not volatile*/
private int privateIntMemberField;
int intMemberField;
protected int protectedIntMemberField;
public int publicIntMemberField; private final int privateFinalIntMemberField=0;
final int finalIntMemberField=0;
protected final int protectedFinalIntMemberField=0;
public final int publicFinalIntMemberField=0; private static int privateStaticIntMemberField;
static int staticIntMemberField;
protected static int protectedStaticIntMemberField;
public static int publicStaticIntMemberField; private final static int privateFinalStaticIntMemberField=0;
final static int finalStaticIntMemberField=0;
protected final static int protectedFinalStaticIntMemberField=0;
public final static int publicFinalStaticIntMemberField=0; /*constructors*/
private A( ){}
A(int i ){}
protected A(int i,int j ){}
public A(int i,int j,int k){} /*methods*/
private final static synchronized native void privateFinalStaticSynchronizedNativeVoidMethod();
final static synchronized native void finalStaticSynchronizedNativeVoidMethod();
protected final static synchronized native void protectedFinalStaticSynchronizedNativeVoidMethod();
public final static synchronized native void publicFinalStaticSynchronizedNativeVoidMethod(); private static synchronized native void privateStaticSynchronizedNativeVoidMethod();
static synchronized native void staticSynchronizedNativeVoidMethod();
protected static synchronized native void protectedStaticSynchronizedNativeVoidMethod();
public static synchronized native void publicStaticSynchronizedNativeVoidMethod(); private final synchronized native void privateFinalSynchronizedNativeVoidMethod();
final synchronized native void finalSynchronizedNativeVoidMethod();
protected final synchronized native void protectedFinalSynchronizedNativeVoidMethod();
public final synchronized native void publicFinalSynchronizedNativeVoidMethod(); private synchronized native void privateSynchronizedNativeVoidMethod();
synchronized native void synchronizedNativeVoidMethod();
protected synchronized native void protectedSynchronizedNativeVoidMethod();
public synchronized native void publicSynchronizedNativeVoidMethod(); private final static native void privateFinalStaticNativeVoidMethod();
final static native void finalStaticNativeVoidMethod();
protected final static native void protectedFinalStaticNativeVoidMethod();
public final static native void publicFinalStaticNativeVoidMethod(); private static native void privateStaticNativeVoidMethod();
static native void staticNativeVoidMethod();
protected static native void protectedStaticNativeVoidMethod();
public static native void publicStaticNativeVoidMethod(); private final native void privateFinalNativeVoidMethod();
final native void finalNativeVoidMethod();
protected final native void protectedFinalNativeVoidMethod();
public final native void publicFinalNativeVoidMethod(); private native void privateNativeVoidMethod();
native void nativeVoidMethod();
protected native void protectedNativeVoidMethod();
public native void publicNativeVoidMethod(); private final static synchronized void privateFinalStaticSynchronizedVoidMethod(){};
final static synchronized void finalStaticSynchronizedVoidMethod(){};
protected final static synchronized void protectedFinalStaticSynchronizedVoidMethod(){};
public final static synchronized void publicFinalStaticSynchronizedVoidMethod(){}; private static synchronized void privateStaticSynchronizedVoidMethod(){};
static synchronized void staticSynchronizedVoidMethod(){};
protected static synchronized void protectedStaticSynchronizedVoidMethod(){};
public static synchronized void publicStaticSynchronizedVoidMethod(){}; private final synchronized void privateFinalSynchronizedVoidMethod(){};
final synchronized void finalSynchronizedVoidMethod(){};
protected final synchronized void protectedFinalSynchronizedVoidMethod(){};
public final synchronized void publicFinalSynchronizedVoidMethod(){}; private synchronized void privateSynchronizedVoidMethod(){};
synchronized void synchronizedVoidMethod(){};
protected synchronized void protectedSynchronizedVoidMethod(){};
public synchronized void publicSynchronizedVoidMethod(){}; private final static void privateFinalStaticVoidMethod(){};
final static void finalStaticVoidMethod(){};
protected final static void protectedFinalStaticVoidMethod(){};
public final static void publicFinalStaticVoidMethod(){}; private static void privateStaticVoidMethod(){};
static void staticVoidMethod(){};
protected static void protectedStaticVoidMethod(){};
public static void publicStaticVoidMethod(){}; private final void privateFinalVoidMethod(){};
final void finalVoidMethod(){};
protected final void protectedFinalVoidMethod(){};
public final void publicFinalVoidMethod(){}; private void privateVoidMethod(){};
void voidMethod(){};
protected void protectedVoidMethod(){};
public void publicVoidMethod(){}; // private abstract final static synchronized native void privateAbstractFinalStaticSynchronizedNativeVoidMethod(){};
// abstract final static synchronized native void abstractFinalStaticSynchronizedNativeVoidMethod(){};
// protected abstract final static synchronized native void protectedAbstractFinalStaticSynchronizedNativeVoidMethod(){};
// public abstract final static synchronized native void publicAbstractFinalStaticSynchronizedNativeVoidMethod(){}; // private abstract static synchronized native void privateAbstractStaticSynchronizedNativeVoidMethod();
// abstract static synchronized native void abstractStaticSynchronizedNativeVoidMethod();
// protected abstract static synchronized native void protectedAbstractStaticSynchronizedNativeVoidMethod();
// public abstract static synchronized native void publicAbstractStaticSynchronizedNativeVoidMethod(); // private abstract final synchronized native void privateAbstractFinalSynchronizedNativeVoidMethod(){};
// abstract final synchronized native void abstractFinalSynchronizedNativeVoidMethod(){};
// protected abstract final synchronized native void protectedAbstractFinalSynchronizedNativeVoidMethod(){};
// public abstract final synchronized native void publicAbstractFinalSynchronizedNativeVoidMethod(){}; // private abstract synchronized native void privateAbstractSynchronizedNativeVoidMethod(){};
// abstract synchronized native void abstractSynchronizedNativeVoidMethod(){};
// protected abstract synchronized native void protectedAbstractSynchronizedNativeVoidMethod(){};
// public abstract synchronized native void publicAbstractSynchronizedNativeVoidMethod(){}; // private abstract final static native void privateAbstractFinalStaticNativeVoidMethod(){};
// abstract final static native void abstractFinalStaticNativeVoidMethod(){};
// protected abstract final static native void protectedAbstractFinalStaticNativeVoidMethod(){};
// public abstract final static native void publicAbstractFinalStaticNativeVoidMethod(){}; // private abstract static native void privateAbstractStaticNativeVoidMethod(){};
// abstract static native void abstractStaticNativeVoidMethod(){};
// protected abstract static native void protectedAbstractStaticNativeVoidMethod(){};
// public abstract static native void publicAbstractStaticNativeVoidMethod(){}; // private abstract final native void privateAbstractFinalNativeVoidMethod(){};
// abstract final native void abstractFinalNativeVoidMethod(){};
// protected abstract final native void protectedAbstractFinalNativeVoidMethod(){};
// public abstract final native void publicAbstractFinalNativeVoidMethod(){}; // private abstract native void privateAbstractNativeVoidMethod();
// abstract native void abstractNativeVoidMethod();
// protected abstract native void protectedAbstractNativeVoidMethod();
// public abstract native void publicAbstractNativeVoidMethod(); // private abstract final static synchronized void privateAbstractFinalStaticSynchronizedVoidMethod();
// abstract final static synchronized void abstractFinalStaticSynchronizedVoidMethod();
// protected abstract final static synchronized void protectedAbstractFinalStaticSynchronizedVoidMethod();
// public abstract final static synchronized void publicAbstractFinalStaticSynchronizedVoidMethod(); // private abstract static synchronized void privateAbstractStaticSynchronizedVoidMethod();
// abstract static synchronized void abstractStaticSynchronizedVoidMethod();
// protected abstract static synchronized void protectedAbstractStaticSynchronizedVoidMethod();
// public abstract static synchronized void publicAbstractStaticSynchronizedVoidMethod(); // private abstract final synchronized void privateAbstractFinalSynchronizedVoidMethod(){};
// abstract final synchronized void abstractFinalSynchronizedVoidMethod(){};
// protected abstract final synchronized void protectedAbstractFinalSynchronizedVoidMethod(){};
// public abstract final synchronized void publicAbstractFinalSynchronizedVoidMethod(){}; // private abstract synchronized void privateAbstractSynchronizedVoidMethod();
// abstract synchronized void abstractSynchronizedVoidMethod();
// protected abstract synchronized void protectedAbstractSynchronizedVoidMethod();
// public abstract synchronized void publicAbstractSynchronizedVoidMethod(); // private abstract final static void privateAbstractFinalStaticVoidMethod;
// abstract final static void abstractFinalStaticVoidMethod;
// protected abstract final static void protectedAbstractFinalStaticVoidMethod;
// public abstract final static void publicAbstractFinalStaticVoidMethod; // private abstract static void privateAbstractStaticVoidMethod();
// abstract static void abstractStaticVoidMethod();
// protected abstract static void protectedAbstractStaticVoidMethod();
// public abstract static void publicAbstractStaticVoidMethod(); // private abstract final void privateAbstractFinalVoidMethod();
// abstract final void abstractFinalVoidMethod();
// protected abstract final void protectedAbstractFinalVoidMethod();
// public abstract final void publicAbstractFinalVoidMethod(); // private abstract void privateAbstractVoidMethod();
abstract void abstractVoidMethod();
protected abstract void protectedAbstractVoidMethod();
public abstract void publicAbstractVoidMethod();
}
枚举java语言中的修饰符组合的更多相关文章
- JAVA语言中的修饰符
JAVA语言中的修饰符 -----------------------------------------------01--------------------------------------- ...
- 关于Java语言中那些修饰符
一.在java中提供的一些修饰符,这些修饰符可以修饰类.变量和方法,在java中常见的修饰符有:abstract(抽象的).static(静态的).public(公共的).protected(受保护的 ...
- C#语言中的修饰符
public:公有访问.不受任何限制. private:私有访问.只限于本类成员访问,子类和实例都不能访问. protected:保护访问.只限于本类和子类访问,实例不能访问. internal:内部 ...
- 2020重新出发,JAVA入门,标识符&修饰符
标识符(Identifier ) 标识符是程序员用来命名变量,方法,类或标签的单词,其实就是我们在开发过程中凡是自己可以命名的一些单词就是标识符 标识符命名规则 标识符由字母(a-z,A-Z),数字( ...
- Java语言中的访问权限修饰符
一个Java应用有很多类,但是有些类,并不希望被其他类使用.每个类中都有数据成员和方法成员,但是并不是每个数据和方法,都允许在其他类中调用.如何能做到访问控制呢?就需要使用访问权限修饰符. Java语 ...
- Java中访问修饰符public、private、protecte、default
Java中访问修饰符public.private.protecte.default的意义讲解:public: Java语言中访问限制最宽的修饰符,一般称之为“公共的”.被其修饰的类.属性以及方法不 仅 ...
- Java中的 修饰符
java中的修饰符分为类修饰符,字段修饰符,方法修饰符. 根据功能的不同,主要分为以下几种. 1.权限访问修饰符 访问权限的控制常被称为具体实现的隐藏 把数据和方法包进类中,以及具体实现的隐藏,常共 ...
- Java中final修饰符深入研究
一.开篇 本博客来自:http://www.cnblogs.com/yuananyun/ final修饰符是Java中比较简单常用的修饰符,同时也是一个被"误解"较多的修饰符.对很 ...
- Java中各种修饰符与访问修饰符
Java中各种修饰符与访问修饰符 类: 访问修饰符 修饰符 class 类名称 extends 父类名称 implement 接口名称 (访问修饰符与修饰符的位置可以互换) 访问修饰符 名称 说明 备 ...
随机推荐
- docker容器的学习
什么是docker Docker 最初是 dotCloud 公司创始人 Solomon Hykes 在法国期间发起的一个公司内部项目,于 2013 年 3 月以 Apache 2.0 授权协议开源 ...
- Java常考面试题整理(五)
81.RMI中的远程接口(Remote Interface)扮演了什么样的角色? 参考答案: 远程接口用来标识哪些方法是可以被非本地虚拟机调用的接口.远程对象必须要直接或者是间接实现远程接口.实现了远 ...
- PriorityQueue源码阅读
最小堆:优先级权重越小 离顶点越近 案例 实现一个top max n publish static int[] topN(int[] nums, int l){ int[] result = new ...
- 选题 Scrum立会报告+燃尽图 05
此作业要求参见:https://edu.cnblogs.com/campus/nenu/2019fall/homework/8749 一.小组情况组长:贺敬文组员:彭思雨 王志文 位军营 杨萍队名:胜 ...
- 使用OMF特性
Oracle 的OMF全称"Oracle managed file",关于这个概念的参考请自行查阅Oracle官方文档"Using Oracle-Managed File ...
- leetcode 94二叉树的中序遍历
递归算法C++代码: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; ...
- 在 Android 中如何调用 C 语言?
当我们的 Java 需要调用 C 语言的时候可以通过 JNI 的方式,Java Native Interface.Android 提供了对 JNI 的支持, 因此我们在 Android 中可以使用 J ...
- nodejs之express中间件路由使用
1.express 中间件使用 /* * 中间件:就是匹配路由之前和匹配路由之后做的一系列操作 */ var express = require('express'); var app = new e ...
- 阶段3 3.SpringMVC·_01.SpringMVC概述及入门案例_05.入门程序之入门代码编写
先把默认的index.jsp删掉.默认的index.jsp没有jsp的声明 ok webapp文件夹下new一个 起名叫做index.新建的页面有jsp的头 创建控制器类 java下新建一个class ...
- 阶段3 2.Spring_08.面向切面编程 AOP_7 通用化切入点表达式
下面配置了通用的表达式,,上面的四个就不用再配置那么长 索罗的切入点表达式了. 节省了每次都要写一长段表达式的过程 写在一个aop:aspect这个切面下面就只能当前切面用 写在切面里面 运行测试 挪 ...