Home » JAVA Programming » Basic Operators » Question
  1. What is the output of this program?

    public class ternary_operator_Example
    {
    public static void main(String args[])
    {
    int a = 5;
    int b = ~ a;
    int c;
    c = a > b ? a : b;
    System.out.print(c);
    }
    }
    1. 6
    2. 4
    3. 3
    4. 5
    5. 2
Correct Option: D

Output: 5



Your comments will be displayed only after manual approval.