🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Magic Methods and Properties: all 10 questions

Quiz: Magic Methods and Properties · Question 9 of 10

When is @staticmethod the right choice?

When is @staticmethod the right choice?

  1. A.When the method needs to change object attributes
  2. B.When the method must create a new object of the class
  3. C.When the helper needs neither the object nor the class, but belongs with the class logically
  4. D.When the method should run automatically
Answer & explanation

Correct answer: When the helper needs neither the object nor the class, but belongs with the class logically

A staticmethod is a plain function placed inside the class namespace.

Can you get the rest right without peeking?

Take the timed Quiz: Magic Methods and Properties quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →