五、所有类型的Class
public class Demo03 {
public static void main(String[] args) {
//1.对象
Class c1 = Object.class;
//2.接口
Class c2 = Comparable.class;
//3.一维数组
Class c3 = String[].class;
//4.二维数组
Class c4 = int[][].class;
//5.注解
Class c5 = Override.class;
//6.基本数据类型
Class c6 = ElementType.class;
//7.void
Class c7 = void.class;
//8. Class
Class c8 = Class.class;
//只要元素类型和维度一样,就是同一个Class
int[] a = new int[10];
int[] b = new int[100];
System.out.println(a.getClass().hashCode());
System.out.println(b.getClass().hashCode());
}
}