Properties:

Properties xxx = new Properties();

xxx.load(InputStream arg0);  xxx.load(new FileInputStream(new File()));  File file = new File(String xxx);

public class TestProperties {

	public static void main(String[] args) {
		
		Properties props = new Properties();
		
		try {
			props.load(new FileInputStream(new File("D:\\work\\properties\\test.properties")));
			String val = props.getProperty("ydx");
			System.out.println(val);
			
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}

}



Test.properties :

ydx=abc





本文转载:CSDN博客