Java program which takes the value from external files
It is stored with property file in sonuasher89 in inbox
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
public class PropertiesClass {
public static void main(String[] args)
{
Properties props = new Properties();
try {
props.load(new FileInputStream(new File("C:/Documents and Settings/folder/Wrk_SPS/PropertiesTest/src/sample.properties")));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(props.getProperty("sample"));
}
}
No comments:
Post a Comment