package J20250806.reflection;

import java.util.Arrays;

/**
 * @author WanJl
 * @version 1.0
 * @title Demo04_ClassTest
 * @description 获取类的所有父类和接口
 * @create 2025/8/6
 */
public class Demo04_ClassTest {
    public static void main(String[] args) {
        Class<? extends String> stringClass = new String().getClass();
        //获取类的父类
        Class<?> superclass = stringClass.getSuperclass();
        System.out.println("String类型的父类"+superclass);
        //获取类的接口
        Class<?>[] interfaces = stringClass.getInterfaces();
        System.out.println(Arrays.toString(interfaces));
    }
}
