Practice mode Java

Which members can a Java static method use directly, without an object reference?

Correct answer C. Static members of its class

Explanation

A static method belongs to the class and runs without any current object, so it can directly use only static fields and methods. Naming an instance field or calling an instance method without an explicit object reference is a compile-time error. It may still reach instance members through a reference such as obj.value.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.