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?
This is correct, according to the official documentation: “Boolean options are turned on with
-XX:+<option>and turned off with-XX:-<option>.”That’s because some may be enabled and others disabled per default, and this may change between Java releases.