Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Properties class

 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

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

Plsssssssssssssss
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you want to do with it?
 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic