and logical operator java code example
Example 1: condition operator in java
b = (a == 1) ? 20: 30;
Example 2: Operators in java
// example on ternary operator in java
public class TernaryOperatorDemo
{
public static void main(String[] args)
{
int a = 50, b = 500, bigger;
System.out.println("First number: " + a);
System.out.println("Second number: " + b);
bigger = (a > b) ? a : b;
System.out.println("Bigger number is = " + bigger);
}
}