Reading file from Property file
public class ReadingFiles {
String Fistname;
String Lastname;
String Age;
static Properties jd= new Properties();
public static void main(String args[]) throws IOException
{
ReadingFiles readFile=new ReadingFiles();
readFile.readPropertyFile();
}
public void readPropertyFile() throws IOException
{
InputStream journeyD= new FileInputStream("F:/eclipse/Practice/BookWriting/TestFiles.properties");
jd.load(journeyD);
Fistname=jd.getProperty("Name");
Lastname=jd.getProperty("LastName");
Age=jd.getProperty("Age");
System.out.println("Fistname:-"+" "+Fistname+"\n"+"Lastname:-"+Lastname+"\n"+"Age:-"+Age);
}
}
Property file-
Output-
No comments:
Post a Comment