Properties-getProperty

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

}

 

}

posted @ 2017-01-17 13:22  mabelfdm  阅读(190)  评论(0编辑  收藏  举报