Java
condition operator
Q.1 ] what is the condition operator and syntax?
·
It is a
trinary operator
·
Syntax
(Condition? choice1: choice2)
It returns true or
false value maybe choice 1 true fan false value and it is choice 2
Q.2] write a program to condition operator use:-
Program class Condition {
Public static void main(String args[]) {
Int a=5, b=6, x;
X= (a>b)?a:b;
System.out.println(“the value of” +x)
}
}
0 Comments