Computer Science, asked by likhitrajbehera, 11 months ago

Compare if and conditional operator (? :).​

Answers

Answered by Anonymous
6

Explanation:

if is called conditional statement while (?:) is conditional/ternary operator.

(?:) conditional/ternary operator operates on three operands(value or variable).

syntax for if:

if(condition)

{

statements

}

syntax for conditional operator:

variable=(condition)?true part:false part;

Answered by Anonymous
2

The java ternary operator or conditional operator takes three operands, one condition followed by a question mark (?), then an expression to be executed if the condition is true followed by a colon (:), and the expression to be executed if the condition is false. It is similar to “if else” statement.

Similar questions