Single Choice
Moderate
QCondition inside if must evaluate to:
ID: #25853
MCQ Quiz - Class 8 - Programming
6 views
Question Info
#25853Q ID
ModerateDifficulty
MCQ Quiz - Class 8 - ProgrammingTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
Correct Answer Explanation:
In Java, the if condition MUST be a boolean expression (true or false). This is stricter than languages like C where 0/nonzero worked.
Why the other options are incorrect:
- Option B: int alone isn't a boolean condition in Java.
- Option C: String isn't a valid if condition in Java.
- Option D: double isn't a valid if condition in Java.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic