Skip to content
Sharp

Object-oriented programming · interview question

Why does fields in a Java class matter in this design?

Multiple choiceEasychapter-2-curatedpremiumoopobject-references
Choose one answer
Answer and explanation

Correct answer

C. To store data specific to an object.

Why

Fields in a Java class are used to store data that is specific to each instance of a class. They represent the object's state and are often accessed and modified through methods.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →