java.util.Properties类

来源:互联网 发布:网站美工工作职责 编辑:程序博客网 时间:2024/06/07 19:36
# import java.io.InputStream;  # import java.util.Enumeration;  # import java.util.Properties;  #   # public class PropertiesTest {  #   #     public static void readProperties(String fileName) {  #         try {  #             Properties props = new Properties();  #   #             /* #              String fileName1 = "src/util/oracle.properties"; #              BufferedInputStream bis = new BufferedInputStream( #              new FileInputStream(fileName));*/  #   #             // String fileName = "oracle.properties";  #             InputStream in = PropertiesTest.class.getResourceAsStream(fileName);  #   #             props.load(in);  #             Enumeration enu = props.propertyNames();  #             while (enu.hasMoreElements()) {  #                 String key = (String) enu.nextElement();  #                 String property = props.getProperty(key);  #                 System.out.println(key + "=" + property);  #             }  #         } catch (Exception e) {  #             e.printStackTrace();  #         }  #     }  #   #     public static void main(String[] args) {  #   #         String fileName = "oracle.properties";  #         readProperties(fileName);  #   #     }  # }  


Java如何遍历Map的所有的元素
http://lehsyh.iteye.com/blog/607481

java读取配置文件的几种方法
http://lehsyh.iteye.com/blog/637446
0 0
原创粉丝点击