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

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

Let’s see a Java properties file example.

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

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

# 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 examples.