πŸ“Š JAVA
Q. What is the output of the Java code snippet with a Ternary operator?
Code:
void show()
{
  int num = true ? getNumber() : 20;
  System.out.print("TOMATO=" + num);
}
	
void getNumber()
{
  System.out.print(30);
}
  • (A) TOMATO=0
  • (B) TOMATO=20
  • (C) TOMATO=30
  • (D) Compiler error
πŸ’¬ Discuss
βœ… Correct Answer: (D) Compiler error

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

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