Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we have multiline comments in a Java properties file?

In a Java .properties file we can do single line comments with #.

Is there any way by which we can do multi-line comments?

like image 592
Rakesh Juyal Avatar asked Nov 11 '10 16:11

Rakesh Juyal


People also ask

How can you write multiline comments in Java?

Multi-line comments start with /* and ends with */ . Any text between /* and */ will be ignored by Java.

How do I add comments in app properties?

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.

What is the use of multiline comment?

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.


2 Answers

Unfortunately not! Java properties file only have single line # comments.

like image 192
Adrian Smith Avatar answered Sep 19 '22 18:09

Adrian Smith


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.

like image 26
zaboco Avatar answered Sep 21 '22 18:09

zaboco