Reputation: 10131
While using Java Options, i found they are of two types. One that has "-" as a prefix and another as "+". For example:
-XX:-UseParallelGC
XX:+UseThreadPriorities
Is there some reason why we have both "+" as well as "-". Initially, i thought that + would mean enabling while - would mean disabling. But, if we want any option disabled than why even pass it along the command line?
Upvotes: 2
Views: 554
Reputation: 346476
Initially, i thought that + would mean enabling while - would mean disabling.
This is correct, according to the official documentation: "Boolean options are turned on with -XX:+<option>
and turned off with -XX:-<option>
."
But, if we want any option disabled than why even pass it along the command line?
That's because some may be enabled and others disabled per default, and this may change between Java releases.
Upvotes: 6
Reputation: 91349
Because the option may be enabled by default, and you need to be able to disable it.
Upvotes: 2
Reputation: 59634
If this option is automatically enabled, you need an explicit way to disable it too.
Upvotes: 1