I have heard that Properties class/file is very helpful whenver you want to add something new to existing,instead manipulating the java code, you can just add new things to properties file and that will reflected in your o/p when you compile java code.
Can someone please explain its use with example please..... I will be thankful to you all.
Thanks in advance Dinesh
posted 8 years ago
Hi, I am giving a small example of how to read the properties file. In the properties file, i am using Driverclass, Drierurl, username and password which are useful for obtainging database connection. I am reading the properties file through java code. So, later when you change the driver also, just change the properties file. ans Run the program, all the changes will be reflected in your program.
while running the above file use java -DFile="Path where you stored the file.props file"