23 - Ternary Operator (?:) in Java (Hindi/Urdu)
LIKE, SHARE & SUBSCRIBE In this video, we are going to discuss "Ternary Operator in Java". Ternary Operators are those operators which operate on 3 operands simultaneously. And in Java, there is only one operator which qualifies the condition of the ternary operator. And it is known as "Conditional Operator". As the name suggests, Conditional Operator is used to check the status of a specific condition. The conditional operator is also known as "Three-Way Operator" because here we are performing some actions on 3 operands. Conditional Operator is denoted by (?:). And it's syntax is expression1? expression2: expression3 ; Here "expression1" is the place-holder for our conditional statement, "expression2" is a place-holder for the result if the conditional statement is satisfied & "expression3" is a place-holder for the result if the conditional statement is not satisfied. Some important points to remember in conditional operator : 1) The return type of conditional statement is always a boolean type. 2) The data type of both expression2 and expression3 must be same and can't be void. Also, we can do nesting of conditional operators. By nesting, we can implement conditional operator inside another conditional operator. Thanks for watching & stay tuned. Like us on Facebook - https://goo.gl/y7oxYc Follow us on Twitter - https://goo.gl/UKmTfn
Download
0 formatsNo download links available.