Java Reference
In-Depth Information
Table 3-1. Determining the result type of a conditional expression
Resulttypedeterminationbeginsfromthetopofthetable;thecompilerappliesthefirst
matching rule. The Operand 2 and Operand 3 columns refer to operand2 and operand3
(from the previous definition) respectively. In the table, constant int refers to constant
expressions of type int (such as '0' or variables declared final ).
For the final table row, S1 and S2 are the types of the second and third operands, re-
spectively.T1isthetypethatresultsfromapplyingboxingconversiontoS1,andT2isthe
type that results from applying boxing conversion to S2. The type of the conditional ex-
pressionistheresultofapplyingcaptureconversiontotheleastupperboundofT1andT2.
See§5.1.7,“BoxingConversion,”§5.1.10,“CaptureConversion,”and§15.12.2.7,“Infer-
ring Type Arguments Based on Actual Arguments” of the JLS for additional information
[JLS 2013].
Search WWH ::




Custom Search