The following code snippet will not compile:
int i = 10; System.out.println ( i<20 ? out1 () : out2 () );
Assume that out1 and out2 have method signature: public void out1(); and public void out2();
Select 1 option
Correct Option is : A
It is not permitted for either the second or the third operand expression of the ? operator to be an invocation of a void method.
If one of the operands is of type byte and the other is of type short, then the type of the conditional expression is short.
If one of the operands is of type T where T is byte, short, or char, and the other operand is a constant expression of type int whose value is representable in type T, then the type of the conditional expression is T.