程序员一代码搬运工
【Java学习心得和Java学习技术个人总结】

java, Enumeration ,Properties

还在 理解中

好像枚举

Properties p = new Properties();
// 设置属性
p.setProperty("C", "China");
p.setProperty("A", "America");
p.setProperty("J", "Japan");
p.setProperty("K", "Korea");
p.setProperty("S", "Spain");
// 枚举属性
Enumeration e = p.propertyNames();
System.out.print("The all keys in p:");
while(e.hasMoreElements())
    System.out.println(e.nextElement().toString()+"\t");
System.out.println();
System.out.println("The property of key 'K' is " + p.getProperty("K"));
System.out.println("The property of key 'J' is " + p.getProperty("J"));
System.out.println("The property of key 'Q' is " + p.getProperty("Q"));

 

赞(0)
未经允许不得转载:程序员一代码搬运工 » java, Enumeration ,Properties
分享到: 更多 (0)