前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >java中Properties有什么用,举例说明

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

作者头像
马克java社区
修改2021-04-30 10:12:41
6160
修改2021-04-30 10:12:41
举报
文章被收录于专栏:java大数据

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

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文系转载前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档