Originally posted by Dinesh Tahiliani:
... I just want to know its use. i have listen that instead of doing changes in your code, you can do the changes in properties file and run your code...
The Properties class has a lot of uses. Here's an example of what you're describing. Suppose you have an XML file called props.xml...
Here's some Java code that will read this XML file, create a new Properties instance from it, and use that to output the dog's name.
Now, if you compile and run this, you will see the output: The dog is Jane Jetson. You can change the dog entry to its correct value of "Dino" in the XML file...
Then --
without recompiling the code -- you can run the Java program again to see the corrected output: The dog is Dino.