Skip to content
Sharp

Core Java · interview question

Which statement is true about the 'if' condition in Java?

Multiple choiceEasychapter-1-curatedpremiumcore-javacode-reading-and-debugging
Choose one answer
Answer and explanation

Correct answer

A. An 'if' condition can be followed by 'else if' and 'else'.

Why

In Java, an 'if' condition can optionally be followed by 'else if' and 'else' blocks to handle multiple conditions or a default case. It is not mandatory to use 'else'.

Test yourself on Core Java

A free test with instant, explained results. No account needed.

Start free test
All Core Java questions →