码迷,mamicode.com
首页 > 其他好文 > 详细

Properties-getProperty

时间:2017-01-17 14:13:45      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:null   oid   htm   imp   http   print   load   bsp   blog   

package

intensiveexercise;

 

import

java.io.FileInputStream;

import

java.io.IOException;

import

java.util.Properties;

///http://www.cnblogs.com/bakari/p/3562244.html

public

class Q18Properties {

 

public static void main(String[] args) throws IOException {

// TODO Auto-generated method stub

Properties prop = new Properties ();

FileInputStream fis = new FileInputStream ("Q:/Users/a496006.DMN1.000/Desktop/q13/Message.properties");

prop.load(fis);

System.out.println(prop.getProperty("welcome1")); //

System.out.println(prop.getProperty("welcome2", "Test"));//Default Test

System.out.println(prop.getProperty("welcome3"));  //Null

}

 

}

Properties-getProperty

标签:null   oid   htm   imp   http   print   load   bsp   blog   

原文地址:http://www.cnblogs.com/mabel/p/6292666.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!