Home >Java >javaTutorial >What is the concept of Class class in java
1. Description
Class itself is also a class.
Class objects can only be determined by the system.
Only one Class instance in the JVM can load a class.
Class corresponds to the .class file loaded in the JVM.
Instances of each class will remember which Class instance it was generated from.
Through Class, you can fully obtain all loaded structures in a class.
Class is the root of Reflection. For any class you want to load and run dynamically, you can only obtain the corresponding Class object first.
2. Example
package com.volcano.reflection; import java.lang.annotation.ElementType; public class TestReflection2 { public static void main(String[] args) { Class a = Object.class;//类 Class b = Runnable.class;//接口 Class c = String[].class;//数组,只要元素类型和维度一样,都是一个class Class d = int[][].class;//二维数组 Class e = Override.class;//注解 Class f = ElementType.class;//枚举类型 Class g = Integer.class;//基本数据类型 Class h = void.class;//void Class i = Class.class;//Class System.out.println(a); System.out.println(b); System.out.println(c); System.out.println(d); System.out.println(e); System.out.println(f); System.out.println(g); System.out.println(h); System.out.println(i); } }
The above is the detailed content of What is the concept of Class class in java. For more information, please follow other related articles on the PHP Chinese website!