结果:
代码:
public static void main(String[] args) {
//自己编写的读取配置文件的方法
InputStream inputStream = FtpConfig.class.getResourceAsStream("/ftp.properties");
Properties properties =new Properties();//Map接口的实现类
try {
properties.load(inputStream);
//System.out.println(properties.get("mybatis.typeAliasesPackage")+"............");
Set<Object> objects = properties.keySet();//返回map的所有key
//objects.iterator(); 遍历map至少要知道2种方法
for (Object object : objects) {
System.out.println("key:"+object+",value:"+properties.get(object));
}
} catch (IOException e) {
e.printStackTrace();
}
}