Click here to watch in Youtube :
https://www.youtube.com/watch?v=YJsQppAzi9A&list=UUhwKlOVR041tngjerWxVccw
db.properties
user=root password=oracle
import java.io.FileReader; import java.io.IOException; import java.util.Properties; /* * public void list(PrintStream out) * * Parameters: * ---------- * * out - an output stream. */ class PropertiesDemo { public static void main(String[] args) throws IOException { try (FileReader fileReader = new FileReader("db.properties");) { Properties p = new Properties(); /* * Reads a property list (key and element pairs) * from the input character stream in a simple * line-oriented format. */ p.load(fileReader); /* * Prints this property list out to the * specified output stream.This method is useful * for debugging. */ p.list(System.out); } } }Output
-- listing properties -- user=root password=oracleClick the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/PropertiesDemo_list_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/PropertiesDemo_list_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/2010ece32ddd64329464f57cc3a56f059cb8f810/BasicJava/PropertiesDemo_list_App/?at=master
See also:
No comments:
Post a Comment