首页 > 编程语言 > 详细

java中Properties有什么用,举例说明?

时间:2021-07-26 22:43:12      阅读:25      评论:0      收藏:0      [点我收藏+]

3.9 Properties的用法

马克-to-win:Properties里面存着也是键值对,而且它更方便java对配置文件,字符串的操作,

例:3.9.1


import java.util.*;
public class TestMark_to_win {
    public static void main(String args[]) {
        Properties sala = new Properties();
        Set name;
        String str;
        sala.put("zs", "1111");
        sala.put("ls", "2222");
        sala.put("ww", "3333");
        sala.put("zl", "4444");

        // Show all name and sala in hashtable.
        name = sala.keySet(); // get set-view of keys
        Iterator itr = name.iterator();
        while (itr.hasNext()) {
            str = (String) itr.next();
            System.out.println("The sala of " +
            /* public String getProperty(String key)Searches for the property
             * with the specified key in this property list.*/
            str + " is " + sala.getProperty(str) + ".");
 
更多请见:https://blog.csdn.net/qq_44639795/article/details/103087533

java中Properties有什么用,举例说明?

原文:https://www.cnblogs.com/xiaolongxia1922/p/15062865.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!