Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between equals and colon in Java properties file

In spring, you can have different properties files in order to configure the messages, so they tend to be something like this:

message.key=text here
another.message.key=another text here

But today I saw in a project that it was using this format:

message.key:text here
another.message.key:another text here

I think this applies to any Java properties file, but what is the difference if any?

like image 976
Pablo Matias Gomez Avatar asked May 05 '16 20:05

Pablo Matias Gomez


People also ask

How do you escape colon (:) in properties file?

Make a StringWriter, write your properties file into it, go through the buffer line-by-line looking for "\:" , and replacing it by a single ":" .

What is the main benefit of using properties file in java?

The advantage of using properties file is we can configure things which are prone to change over a period of time without the need of changing anything in code. Properties file provide flexibility in terms of configuration. Sample properties file is shown below, which has information in key-value pair.

What is a property file in java?

properties is a file extension for files mainly used in Java-related technologies to store the configurable parameters of an application. They can also be used for storing strings for Internationalization and localization; these are known as Property Resource Bundles.

How do you comment multiple lines in properties file?

We can use Ctrl + / to comment multiple lines in properties file.

What is the difference between == and equals in Java?

Both equals () method and the == operator are used to compare two objects in Java. == is an operator and equals () is method. But == operator compares reference or memory location of objects in a heap, whether they point to the same location or not.

Is there any difference between equals and colon equals?

Difference between equals and colon equals? Is there any difference between these? The grammar shows semicolons, but never the colon equals. Various examples don't show semicolons but do show the colon equals.

What is the colon equal sign used for in JavaScript?

The colon equal sign := is used to set the value of an parameter (argument) for a property or method. We will use the Worksheets.Add method as an example. The Worksheets.Add method has four optional parameters.

What is the difference between equals () and object equals () methods?

equals () method if not present and Object.equals () method is utilized, otherwise it can be overridden.


1 Answers

If you were really talking about standard Java Properties files, there is no difference between a colon and an equals sign. Either can delimit a key from its value. In fact, you could even mix them in the same file, if you want to annoy readers.

like image 59
erickson Avatar answered Nov 16 '22 01:11

erickson