LearnFrenzy
Sign in Take a free test

Classes and Objects · Classes and Objects MCQ · Question 18

Which object's fields does a method use? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 18 Back to Exercise

When you call acc1.deposit(100), whose balance field is changed?

  • A All accounts'
  • B acc1's – instance methods work on the object they are called on Correct
  • C None
  • D The last created account's
Correct Answer: Option B

Inside the method, this refers to acc1.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links