使用反射进行对象实例化
使用反射进行对象实例化,不再使用new关键字
1.第一种,使用.properties配置文件
首先需要一个实体类:
public class Phone {
String name;
int price;
@Override
public String toString() {
return "Phone{" +
"name='" + name + '\'' +
", price=" + price +
'}';
}
}
接下来新建一个文件夹rescources,在里面创建文件phone.properties

