Skip to content
Sharp

Core Java · interview question

Given 'boolean isAvailable =!(stock < 5);', what is 'isAvailable' if stock is 3?

Multiple choiceMediumchapter-1-curatedpremiumcore-javaoperators-and-expressions
java
boolean isAvailable = !(stock < 5);
Choose one answer
Answer and explanation

Correct answer

A. False

Why

The expression 'stock < 5' evaluates to true. The '!' operator negates this, resulting in 'isAvailable' being false.

Test yourself on Core Java

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

Start free test
All Core Java questions →