← Quiz: Java Classes and Objects: all 10 questions
Quiz: Java Classes and Objects · Question 5 of 10
Why can't a static method use an instance field directly?
Why can't a static method use an instance field directly?
- A.Static methods are slower
- B.It runs without any object, so there is no "this" to read the field from
- C.Instance fields are always private
- D.Java forbids static methods
Answer & explanation
Correct answer: It runs without any object, so there is no "this" to read the field from
Instance fields belong to objects; a static method isn't called on an object.
Can you get the rest right without peeking?
Take the timed Quiz: Java Classes and Objects quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →