publicclass ParseConditional { publicstaticvoid main(String[] args) { boolean condition = true; int a = 1; int b = 2; int c = 3; int d = 4; // The following line should give an error because the conditional ?: operator // is higher priority than the final assignment operator, between c and d. // As such, the correct parsing is: // a = (condition ? b = c : c) = d; // and it is illegal to try and assign to the value of the conditional expression.
a = condition ? b = c : c = d;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.