Chinaunix
标题:
关于StringTokenizer和Properties的一个例子
[打印本页]
作者:
nanjiyun
时间:
2007-04-16 00:13
标题:
关于StringTokenizer和Properties的一个例子
System.out.println("************test StringTokenizer************");
String a="welcome your my friend!";
StringTokenizer s=new StringTokenizer(a,"e");
int cnt=s.countTokens();
System.out.println("count is: "+cnt);
for(int i=0;iprop.put("put", "function extend from Hashtable");//插入一条
prop.setProperty("setProperties", "function in Properties");
prop.store(new FileOutputStream("corejava//ApplicationResources.properties",
true
),"hehe" );//保存
en=prop.keys();//
取出所有的key,继承自Hashtable的方法
while(en.hasMoreElements()){
a=(String)en.nextElement();
System.out.println(a+": "+prop.getProperty(a));
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
本文来自ChinaUnix博客,如果查看原文请点:
http://blog.chinaunix.net/u1/36006/showart_278773.html
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2