来源于 https://www.bilibili.com/video/av55440782/?p=9&spm_id_from=pageDriver
runtime在运行时还有效果;Annotations are to be recorded in the class file by the compiler and retained by the VM at run time, so they may be read reflectively.
class编译成字节码时候还有效果;Annotations are to be recorded in the class file by the compiler but need not be retained by the VM at run time. This is the default behavior.
source在源码时候有效果;Annotations are to be discarded by the compiler.
当为value的时候,注解里面用的时候可以省略这个参数名。
@MyAnnotation(“秦”)。如果参数不是value,那么这里就必须是@MyAnnotation(参数名=“秦”)
创建对象
- new
- clone
- 反射
反射可以获取private方法。
这里,c2,c3,c4都是一样的,它们的hashcode值都是一样的!
一个加载的类,在JVM中只会有一个Class实例。所以不管Class.forName(类的完整路径)
执行多少次,每次的hashcode都是一样的!
只要元素类型与维度一样,那么hashcode是一样的!
逻辑上,方法区是属于堆的,但是1.8之后就分开了。
参考:
1、https://www.bilibili.com/video/av55440782/