Posted on 2006-11-12 23:03
苑 阅读(112)
评论(0) 编辑 收藏 所属分类:
java基础学习系列
import
java.util.Properties;
public class
MainClass
{
public static
void
main
(
String args
[]) {
Properties prop =
new
Properties
()
;
prop.put
(
"a"
,
"1"
)
;
prop.put
(
"b"
,
"2"
)
;
prop.put
(
"c"
,
"3"
)
;
Properties book =
new
Properties
(
prop
)
;
book.put
(
"A"
,
"4"
)
;
book.put
(
"B"
,
"5"
)
;
System.out.println
(
"a "
+ book.getProperty
(
"a"
))
;
System.out.println
(
"A "
+ book.getProperty
(
"b"
))
;
System.out.println
(
"c: "
+ book.getProperty
(
"c"
))
;
System.out.println
(
"z: "
+ book.getProperty
(
"z"
,
"default"
))
;
}
}