package reflect;
import pass.User;
/**
* @Author: DengJia
* @Date: 2021/12/1 9:15
* @Description: 获取Class对象的四种方式
*/
public class MainTest {
public static void main(String[] args) throws ClassNotFoundException {
User u = new User();
// 1.
Class<User> uC1 = User.class;
// 2.
Class<?> uC2 = Class.forName("top.dj.User");
// 3.
Class<? extends User> uC3 = u.getClass();
// 4.
Class<?> uC4 = ClassLoader.getSystemClassLoader().loadClass("top.dj.User");
}
}