SlideShare a Scribd company logo
java.util.Properties
java.lang.Object
java.util.Dictionary<K,V>
java.util.Hashtable<Object,Object>
java.util.Properties
• public class Properties extends
Hashtable<Object,Object>
•
•
•

•

•

The Properties class represents a persistent set of properties. The Properties can be saved to a
stream or loaded from a stream. Each key and its corresponding value in the property list is a string.
A property list can contain another property list as its "defaults"; this second property list is
searched if the property key is not found in the original property list.
Because Properties inherits from Hashtable, the put and putAll methods can be applied to
a Properties object. Their use is strongly discouraged as they allow the caller to insert entries
whose keys or values are not Strings. The setProperty method should be used instead. If
the store or save method is called on a "compromised" Properties object that contains a nonString key or value, the call will fail. Similarly, the call to the propertyNames or list method will fail if
it is called on a "compromised" Properties object that contains a non-String key.
The load(Reader) / store(Writer, String) methods load and store properties from and to a character
based stream in a simple line-oriented format specified below.
The load(InputStream) /store(OutputStream, String) methods work the same way as the
load(Reader)/store(Writer, String) pair, except the input/output stream is encoded in ISO 8859-1
character encoding. Characters that cannot be directly represented in this encoding can be written
using Unicode escapes ; only a single 'u' character is allowed in an escape sequence. The
native2ascii tool can be used to convert property files to and from other character encodings.
The loadFromXML(InputStream) and storeToXML(OutputStream, String, String) methods load and
store properties in a simple XML format. By default the UTF-8 character encoding is used, however
a specific encoding may be specified if required. An XML properties document has the following
DOCTYPE declaration:
Properties()
•

Creates an empty property list with no
default values.
Put()
• It is a inherited method of Hashtable
• public V put(K key, V value)
• Maps the specified key to the specified value in this
hashtable. Neither the key nor the value can be null.
• The value can be retrieved by calling the get method
with a key that is equal to the original key.
• Specified by:put in interface Map<K,V>Specified
by:put in class Dictionary<K,V>
• Parameters:key - the hashtable keyvalue - the
valueReturns:the previous value of the specified key in
this hashtable, or null if it did not have one

More Related Content

PPTX
4- Inheritance, Aggregation, Encapsulation and Overloading
Ghadeer AlHasan
 
PDF
Xtext: type checking and scoping
Mikhail Barash
 
PPTX
Quick Scala
Puneet Kumar
 
PPTX
#6- Arrays and Collections Framework
Ghadeer AlHasan
 
PDF
Xtend Programming Language
Mikhail Barash
 
PPTX
C++ training
PL Sharma
 
PPT
Linq
tnkreddy
 
PPSX
Java session4
Jigarthacker
 
4- Inheritance, Aggregation, Encapsulation and Overloading
Ghadeer AlHasan
 
Xtext: type checking and scoping
Mikhail Barash
 
Quick Scala
Puneet Kumar
 
#6- Arrays and Collections Framework
Ghadeer AlHasan
 
Xtend Programming Language
Mikhail Barash
 
C++ training
PL Sharma
 
Linq
tnkreddy
 
Java session4
Jigarthacker
 

What's hot (20)

PPTX
Java Tutorial Lab 4
Berk Soysal
 
PPTX
Learning core java
Abhay Bharti
 
ODP
Knolx Session: Introducing Extractors in Scala
Ayush Mishra
 
PPTX
Java Tutorial Lab 6
Berk Soysal
 
PPTX
Mutable and immutable classes
Tech_MX
 
PPT
XML SAX PARSING
Eviatar Levy
 
DOCX
Binary search
mnpaliwaldse
 
PPTX
Net framework
Abhishek Mukherjee
 
PPTX
Java Tutorial Lab 3
Berk Soysal
 
PPTX
What's new in Java 8
Kyle Smith
 
PPTX
JavaScript Beyond jQuery
Bobby Bryant
 
PPTX
Classes objects in java
Madishetty Prathibha
 
PPTX
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 2)
Binary Studio
 
PDF
Understanding C# in .NET
mentorrbuddy
 
PPTX
Indexers in C#
AA Coaching Academy
 
PPTX
Java Tutorial Lab 1
Berk Soysal
 
PPTX
PCSTt11 overview of java
Archana Gopinath
 
PPT
Java class
Arati Gadgil
 
PDF
IO Streams, Serialization, de-serialization, autoboxing
Gurpreet singh
 
Java Tutorial Lab 4
Berk Soysal
 
Learning core java
Abhay Bharti
 
Knolx Session: Introducing Extractors in Scala
Ayush Mishra
 
Java Tutorial Lab 6
Berk Soysal
 
Mutable and immutable classes
Tech_MX
 
XML SAX PARSING
Eviatar Levy
 
Binary search
mnpaliwaldse
 
Net framework
Abhishek Mukherjee
 
Java Tutorial Lab 3
Berk Soysal
 
What's new in Java 8
Kyle Smith
 
JavaScript Beyond jQuery
Bobby Bryant
 
Classes objects in java
Madishetty Prathibha
 
Binary Studio Academy PRO: ANTLR course by Alexander Vasiltsov (lesson 2)
Binary Studio
 
Understanding C# in .NET
mentorrbuddy
 
Indexers in C#
AA Coaching Academy
 
Java Tutorial Lab 1
Berk Soysal
 
PCSTt11 overview of java
Archana Gopinath
 
Java class
Arati Gadgil
 
IO Streams, Serialization, de-serialization, autoboxing
Gurpreet singh
 
Ad

More from myrajendra (20)

PPT
Fundamentals
myrajendra
 
PPT
Data type
myrajendra
 
PPTX
Hibernate example1
myrajendra
 
PPTX
Jdbc workflow
myrajendra
 
PPTX
2 jdbc drivers
myrajendra
 
PPTX
3 jdbc api
myrajendra
 
PPTX
4 jdbc step1
myrajendra
 
PPTX
Dao example
myrajendra
 
PPTX
Sessionex1
myrajendra
 
PPTX
Internal
myrajendra
 
PPTX
3. elements
myrajendra
 
PPTX
2. attributes
myrajendra
 
PPTX
1 introduction to html
myrajendra
 
PPTX
Headings
myrajendra
 
PPTX
Forms
myrajendra
 
PPT
Css
myrajendra
 
PPTX
Views
myrajendra
 
PPTX
Views
myrajendra
 
PPTX
Views
myrajendra
 
PPT
Starting jdbc
myrajendra
 
Fundamentals
myrajendra
 
Data type
myrajendra
 
Hibernate example1
myrajendra
 
Jdbc workflow
myrajendra
 
2 jdbc drivers
myrajendra
 
3 jdbc api
myrajendra
 
4 jdbc step1
myrajendra
 
Dao example
myrajendra
 
Sessionex1
myrajendra
 
Internal
myrajendra
 
3. elements
myrajendra
 
2. attributes
myrajendra
 
1 introduction to html
myrajendra
 
Headings
myrajendra
 
Forms
myrajendra
 
Views
myrajendra
 
Views
myrajendra
 
Views
myrajendra
 
Starting jdbc
myrajendra
 
Ad

Recently uploaded (20)

PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Software Development Methodologies in 2025
KodekX
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
The Future of Artificial Intelligence (AI)
Mukul
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 

Properties

  • 2. • public class Properties extends Hashtable<Object,Object>
  • 3. • • • • • The Properties class represents a persistent set of properties. The Properties can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list is a string. A property list can contain another property list as its "defaults"; this second property list is searched if the property key is not found in the original property list. Because Properties inherits from Hashtable, the put and putAll methods can be applied to a Properties object. Their use is strongly discouraged as they allow the caller to insert entries whose keys or values are not Strings. The setProperty method should be used instead. If the store or save method is called on a "compromised" Properties object that contains a nonString key or value, the call will fail. Similarly, the call to the propertyNames or list method will fail if it is called on a "compromised" Properties object that contains a non-String key. The load(Reader) / store(Writer, String) methods load and store properties from and to a character based stream in a simple line-oriented format specified below. The load(InputStream) /store(OutputStream, String) methods work the same way as the load(Reader)/store(Writer, String) pair, except the input/output stream is encoded in ISO 8859-1 character encoding. Characters that cannot be directly represented in this encoding can be written using Unicode escapes ; only a single 'u' character is allowed in an escape sequence. The native2ascii tool can be used to convert property files to and from other character encodings. The loadFromXML(InputStream) and storeToXML(OutputStream, String, String) methods load and store properties in a simple XML format. By default the UTF-8 character encoding is used, however a specific encoding may be specified if required. An XML properties document has the following DOCTYPE declaration:
  • 4. Properties() • Creates an empty property list with no default values.
  • 5. Put() • It is a inherited method of Hashtable • public V put(K key, V value) • Maps the specified key to the specified value in this hashtable. Neither the key nor the value can be null. • The value can be retrieved by calling the get method with a key that is equal to the original key. • Specified by:put in interface Map<K,V>Specified by:put in class Dictionary<K,V> • Parameters:key - the hashtable keyvalue - the valueReturns:the previous value of the specified key in this hashtable, or null if it did not have one