You are here: Home / Topics / Conditional Operators Examples in Java

Conditional Operators Examples in Java

Filed under: Java on 2023-08-11 19:27:39

//Program to explain the concept of Conditional Operator in different style

class ConditionalOperator
{
public static void main( String args[ ] )
{
       int a, b, max;

 a = 25;
 b = 14;

 max = ( ( a > b ) ? a : b );
 System.out.print("\nMaximum Value is= " + max );
}
}


Output:

Maximum Value is= 25

About Author:
V
Vinay Kumar     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.