Java-Properties文件

来源:互联网 发布:安踏网络授权 编辑:程序博客网 时间:2024/06/05 16:11

对如下的信息采用properties文件方式提供
这里写图片描述
这里写图片描述
这里写图片描述

Properties prop = new Properties();FileInputStream fis = null;try {    fis = new FileInputStream("dbinfo.properties");    prop.load(fis);    String username = (String) prop.get("username");    System.out.println(username);} catch (Exception e) {    // TODO: handle exception    e.printStackTrace();} finally {    try {        fis.close();    } catch (IOException e) {        // TODO Auto-generated catch block        e.printStackTrace();    }    fis = null;}
0 0
原创粉丝点击