Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Properties class

 
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
 
Sheriff
Posts: 11343
Mac Safari Java
  • 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
Mac Safari Java
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic