public class Collections {
public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
InputStream is=new FileInputStream("config.prperties");
Properties p=new Properties();
p.load(is);
is.close();
String className=p.getProperty("className");
Collection c=(Collection) Class.forName(className).newInstance();
//Collection c=new HashSet();
ReflactPoint r1=new ReflactPoint(3,5);
ReflactPoint r2=new ReflactPoint(4,5);
ReflactPoint r3=new ReflactPoint(3,7);
c.add(r1);
c.add(r2);
c.add(r3);
c.add(r1);
System.out.println(c.size());
}
}
这个我不知道哪写错了,希望大家帮忙看看,config.prperties文件写在项目目录下跟Src同级 |