首页 > 代码库 > Properties-getProperty

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

}

 

}

Properties-getProperty