Priority of Java's conditional ? : operator
The conditional ? : operator in Java is right-associative. So the expression a<b ? c<d ? 1 : 2 : 3 ; is evaluated as a<b ? (c<d ? 1 : 2) : 3 ; Does this mean that the expression (c<d ? 1: 2) is evaluated first or is the boolean a<b evaluated and the expression (c<d ? 1: 2) is only evaluated afterwards iff a<b is true? In other words: assume c<d is true, is the evaluation then: a<b ? 1: 3; or a<b ? (c<d ? 1 : 2) : 3 ;
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.