如何将字符串转换为Class?

业务逻辑在需要将Class对象作为参数穿进去,可不知道怎么传,又想到可以用字符串转换
然后就用了 Class.forName()强制转换了 但是还是没用 ,有没有什么办法!!

将参数定义为class类型就可以的~
比如定义了类: Class Student
传参就可以:
fun(Student stu)

不知道吧对象用io写如磁盘,在从磁盘,解析出来,能不能解决试试

public class Test {

    public static void main(String[] args) throws IOException {
        test(Test.class);
    }

    public static void test(Class<?> cls) {

    }
}

可以理解成你想要以下两个实现对吗?
1.将class对象转换为字符串。
2.将字符串转换为class。