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

Popular posts from this blog

Calculate Compound Interest in JavaScript

How to make simple bill maker by using python tkinter

Admin Login Page Using HTML and CSS