- 作用:读写资源配置文件
- 键值只能为字符串
- 方法:
setProperty(String key,String value)
getProperty(String key)
getProperty(String key,String defaultvalue)
- 操作(不同后缀)
.properties
store(OutputStream out,String Comment)
store(Writer writer,String Comment)
load(InputStream instream)
load(Reader reader)
.xml
storeToXML(OutputStream out,String Comment)
storeToXML(OutputStream out,String Comment,String encoding)
loadFromXML(InputStream instream)
5.相对路径与绝对路径
- 绝对路径: 盘符:/
- 相对路径:当前项目、工程
6.类路径加载资源文件
- 类名.class.getResourceAsStream("/")
- Thread.currentThread().getContexClassLoader().getResourceAsStream(" ")