```
public class PropsTest {
public static void main(String[] args)throws Exception{
File f = new File(System.getProperty("user.dir")+"\\test.txt");//这个路径名称根据具体情况
Properties p = new Properties();
p.load(new FileInputStream(f));
System.out.println(p.getProperty("A"));
System.out.println(p.getProperty("B"));
}
}
```
test.txt中内容
```
A=this is A
B = this is B
```
输出是:
```
this is A
this is B
```
说明前面多一些空格也么有关系。而第一个字符不能为空格。
- 参考资料
- 容器的实现
- ArrayList、LinkedList与Vector的区别
- Map,Set,List,Queue,Stack的特点与用法
- HashMap的实现
- HashMap和ConcurrentHashMap差别
- HashMap和HashTable的区别
- fast fail
- java 实用方法
- Collections中实用的函数
- ArrayList中实用的函数
- Integer和Character
- Properties类的简单使用
- XML实用解析
- 从jar包中读取文件信息
- java自带base64加密解密
- java机制
- 分派
- 反射
- 类加载机制
- java中一个对象的初始化
- 泛型
- 自动装箱,拆箱与遍历循环
- 偏向于语法
- new int[]
- new boolean[]
- Switch能否用string做参数
- equals与==的区别
- 泛型对象数组
- Enum的用法
- String、StringBuffer与StringBuilder的区别
- try catch finally
- finalize方法
- object有哪些公用方法
- Java的四种引用,强弱软虚,用到的场景
- java访问修饰符
- Hashcode的作用
- 九种基本数据类型
- java对象大小
- 数组长度
- 动态代理的一个例子
- java.lang.NoClassDefFoundError
- ThreadLocal