Sometimes, We want to include special characters in value of properties file. The properties file is an complete features described below with example

  • Inline Comments
  • key and value pair
  • Encoding
  • Unicode
  • Key and value contains spaces
  • Key and value contains special characters which is escaped by backslash

Let’s see an java properties file example

# This is one way to write a comments in properties
! this is a another way to write a comment in properties

## key can contain spaces with escape by backslash
full\ name= john 
# value can be spaces
full\ name= john\ anderw

# Any special characters (:,=,\,@) are escape in key and values

# unicode

selectquery= select * from table where id=10


In this post, You learned sample properties file with all features with example