Q. What is the output of this program?

Code:
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);
        } 
    }
  • (A) 6
  • (B) 4
  • (C) 3
  • (D) 5
πŸ’¬ Discuss
βœ… Correct Answer: (D) 5

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
195
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Rajeev Malhotra
Publisher
πŸ“ˆ
89%
Success Rate