Structural Description
1. Class: external class, member (member internal class, static internal class), local internal class, anonymous internal class
2. interface: interface
3, []: array
4, enum: enumeration
5, annotation: annotation@interface
6, primitive type : Basic data type
7, void: No return value
Instance
@Test public void test3(){ Class<Object> c1 = Object.class; Class<Comparable> c2 = Comparable.class; Class<String[]> c3 = String[].class; Class<int[][]> c4 = int[][].class; Class<ElementType> c5 = ElementType.class; Class<Override> c6 = Override.class; Class<Integer> c7 = int.class; Class<Void> c8 = void.class; Class<Class> c9 = Class.class; int[] i1 = new int[10]; int[] i2 = new int[100]; Class<? extends int[]> c10 = i1.getClass(); Class<? extends int[]> c11 = i2.getClass(); // 只要数组的元素类型与维度一样,就是同一个Class System.out.println(c10 == c11);//true }
The above is the detailed content of Analyze the instance structure of Java Class files. For more information, please follow other related articles on the PHP Chinese website!