zoukankan      html  css  js  c++  java
  • ResourceBundle读取配置文件

    import java.util.ResourceBundle;

    /**
    * Created by win7 on 2017/5/20.
    */
    public class Test1 {
    public static void main(String[] args) {

    ResourceBundle resb3 = ResourceBundle.getBundle("abc");
    System.out.println("name;"+resb3.getString("name"));
    System.out.println("sex:"+resb3.getString("sex"));
    System.out.println("测试中文:"+resb3.getString("ceshi"));
    System.out.println("ip:"+resb3.getString("ip"));


    ResourceBundle resource = ResourceBundle.getBundle("system_config");
    try {
    String a=new String(resource.getString("lybPayAccountName").getBytes("ISO-8859-1"),"UTF-8");
    System.out.println(a);
    } catch (UnsupportedEncodingException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }


    }



    }

    src下 abc.properties文件
    name=hahh
    sex=bai

    ceshi=测试

    ip=192.168.10.12
  • 相关阅读:
    CSS的扩展less和sass
    html5小游戏基础知识
    htm5拖放和画布
    htm5
    并查集模板
    二叉树的建树
    kmp的书写
    贪心算法
    容器
    POJ2442 优先队列
  • 原文地址:https://www.cnblogs.com/coderdxj/p/6883302.html
Copyright © 2011-2022 走看看