In this tutorial, we are going to write a Java program using conditional operators in Java Programming with practical program code and step-by-step full complete explanation.

Java program using conditional operators


Java program using conditional operators.

 
class Main
{
    public static void main(String args[])
    {

        //taking value as command line argument.
        //Converting String format to Integer value

        int i = Integer.parseInt(args[0]);
        int j = Integer.parseInt(args[1]);
        int result = (i<j)?i:j;

        System.out.println(result+" is a minimum value");
    }
}


Output

 
5 10
5 is a minimum value