一、通过文件路径加载
该方式必须知道文件的真实路径。
1、配置文件放置位置
2、具体代码如下
package cn.sunft.day01.reflect;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Collection;
import java.util.Properties;
/**
*
* @author sunft
*
*/
public class ReflectCollection {
public static void main(String[] args) throws Exception {
InputStream ips = new FileInputStream("config.properties");
Properties props = new Properties();
props.load(ips);
ips.close();
String className = props.getProperty("className");
//这里默认会调用无参数的构造方法
Collection collections = (Collection) Class.fo