Create a program to demonstrate the use of the Conditional Operator in java
Create a program to demonstrate the use of the Conditional Operator in java
public class TernaryOperator
{
public static void main(String args[]){
int a=3;
int b=10;
int c;
c=a>b?(a-b):(b-a);
System.out.println(c);
}
}
Output
7
Comments
Post a Comment