In a Java .properties
file we can do single line comments with #
.
Is there any way by which we can do multi-line comments?
Multi-line comments start with /* and ends with */ . Any text between /* and */ will be ignored by Java.
In addition to properties and blank lines, the application. properties field may contain comments. To comment a line, just put the hash character at the beginning of a line.
Multiline comments are used for large text descriptions of code or to comment out chunks of code while debugging applications. Comments are ignored by the compiler.
Unfortunately not! Java properties file only have single line #
comments.
If you use Eclipse, you can select multiple lines and comment all with a shortcut (Ctrl+/ by default). Same shortcut uncomments the lines, but you have to pay attention no to select any empty line, which will cause the non-empty ones to get commented more than once.
These apply to Eclipse, but I guess many IDE:s and some editors offer similar functionality.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With