java 反射
package com;
public interface IPeople {
public abstract void desc();
}
package com;
public class Women implements IPeople {
@Override
public void desc() {
System.out.print("i am a women,and i am 温柔!");
}
}
Class<?> demo =Class.forName("com.Women");
IPeople per=(IPeople)demo.newInstance();
per.desc();