It is defined in JLS #15.25:
The conditional operator is syntactically right-associative (it groups right-to-left). Thus,
a?b:c?d:e?f:g
means the same asa?b:(c?d:(e?f:g))
.
In your case,
return someboolean ? new someinstanceofsomething() : someotherboolean ? new otherinstance() : new third instance();
is equivalent to:
return someboolean ? new someinstanceofsomething() : (someotherboolean ? new otherinstance() : new third instance());