Properties Class

  • If any data changes frequently in a out program, we should keep that in properties file so that we would not be required do code changes again.
  • Properties Class also hold key value pair just like HashMap but the only difference is it stories only key and values of String type

Methods :

  • String getProperty(String propertyName)
    • If no such property then it returns null
  • String setProperty(String propertyName,String propertyValue)
    • The specified property already available then the old value will be replaced with new value and old value will be returned
  • Enumeration propertyNames()
  • void load(InputStream is)
    • Loading of properties file
  • void store(OutputStream os,String comment)
    • Store data into properties file

Example :

Leave a Comment