Skip to content
Sharp

Core Java · interview question

Which of the following correctly determines if a boolean 'isPremiumMember' is set to true?

Multiple choiceEasychapter-1-curatedpremiumcore-javaconditions-and-branching
Choose one answer
Answer and explanation

Correct answer

B. If (isPremiumMember) {}

Why

To check if a boolean is true, you can simply use the if statement with the variable name without any comparison operator.

Test yourself on Core Java

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

Start free test
All Core Java questions →