Q. What is the output of the Java code snippet with Ternary operator?

Code:
int num = false?10:20;
System.out.println(num);
  • (A) 10
  • (B) 20
  • (C) 0
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 20

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
217
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
86%
Success Rate