首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Java Properties种 按输入顺序输出,每条添加注释

2013-03-16 
Java Properties类 按输入顺序输出,每条添加注释今天想把输入Property类的信息,输出看一下,输出之后发现顺

Java Properties类 按输入顺序输出,每条添加注释

    今天想把输入Property类的信息,输出看一下,输出之后发现顺序是乱的,后来看了代码才明白怎么回事,于是决定自己瞎写一个,经测试还能用。望各位大神观摩指导。。。。

主要是实现两个功能:

1.顺序输出:

    用户通过使用方法setP来插入数据,三个参数分别为key,value,和comment。之后通过orderStore来输出内容。

2.为每条属性添加注释

    通过setP方法添加的属性都会有注释参数。如果只想使用注释这个功能,可以通过java的Properties类来构造此类对象,之后通过addComment方法来为想要添加的属性添加注释



测试程序:

#This is a test process...#Wed Mar 13 15:34:03 CST 2013#the name of 0Name0=0#the name of 1Name1=1#the name of 2Name2=2#the name of 3Name3=3#the name of 4Name4=4#the name of 5Name5=5#the name of 6Name6=6#the name of 7Name7=7#the name of 8Name8=8#the name of 9Name9=9


热点排行