Click here to watch in Youtube :
https://www.youtube.com/watch?v=B-DK57t_qIM&list=UUhwKlOVR041tngjerWxVccw
PropertiesDemo.java
info.propertieshttps://www.youtube.com/watch?v=B-DK57t_qIM&list=UUhwKlOVR041tngjerWxVccw
PropertiesDemo.java
import java.io.FileWriter; import java.io.IOException; import java.util.Properties; /* * public void store(Writer writer, String comments) * throws IOException * * Parameters: * ---------- * * writer - an output character stream writer. * comments - a description of the property list. */ class PropertiesDemo { public static void main(String[] args) throws IOException { try (FileWriter fileWriter = new FileWriter("info.properties")) { Properties p = new Properties(); p.setProperty("name", "Ram"); p.setProperty("email", "ram@yahoo.com"); /* * Writes this property list (key and element * pairs) in this Properties table to the output * character stream in a format suitable for * using the load(Reader) method. */ p.store(fileWriter, "User Info"); System.out.println("Property file is created successfully.."); } } }Output
Property file is created successfully..
#User Info #Wed Mar 01 09:25:09 IST 2017 email=ram@yahoo.com name=RamClick the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/PropertiesDemo_store_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/PropertiesDemo_store_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/2f1fa585daa61fc8fa0957d6f04b940eddbcf7ec/BasicJava/PropertiesDemo_store_App/?at=master
See also:
No comments:
Post a Comment