Skip to content
Sharp

Core Java · interview question

What potential problem can arise from using mutable static fields in a class?

Multiple choiceMediumchapter-3-curatedpremiumcore-javacode-reading-and-state-safety
Choose one answer
Answer and explanation

Correct answer

A. Shared state can lead to unintended side-effects across instances.

Why

Mutable static fields can lead to shared state issues where changes in one part of the program inadvertently affect other parts, potentially leading to bugs and making the program harder to understand and maintain.

Test yourself on Core Java

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

Start free test
All Core Java questions →