import java.util.*;
import java.io.*;

public class PropertiesTest {
	public static void print(String s){
		System.out.println(s);
	}

	public static void main(String[] args){

		Properties prop=new Properties();
		FileReader reader=null;
		try{
			reader=new FileReader("test123.properties");
			prop.load(reader);
		}catch(IOException e){
			print(e.getMessage());
		}finally{
			if(reader!=null){
				try{
					reader.close();
				}catch(IOException e){
					print(e.getMessage());
				}
			}
		}

		/*根据指定的key获取其value*/
		print(prop.getProperty("name"));
		print(prop.getProperty("k.k.k"));
		print(prop.getProperty("animal.dog"));
	}
}
