This is something which I want to do in properties file
#Comments about key Value pair 1
Key_1=value_1
#Comments about key Value pair 2
Key_2=value_2
#Com
There is no way to do what you want using the standard Properties class.
You can, of course, do this by writing the file out yourself. The main thing that you need to be careful of is embedded newlines, and embedded =
and :
in your keys. However, if you really want to be able to store individual comments about each pair, then you probably want a class that maps from
, and then use that map to generate your properties file.