aspose file tools*
The moose likes Beginning Java and the fly likes Properties class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Properties class" Watch "Properties class" New topic
Author

Properties class

Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
Hi Ranchers,

Can someone explain me how to use Properties class in java with the help of eg.

Plsssssssssssssss


Thanks<br />Dinesh
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

What do you want to do with it?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
Can someone expalin me the Properties class in java.

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.

marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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.
Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
Thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Properties class