Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is an instance method?
Think about methods that operate on object data.
Give an example of a static method.
Consider methods that can be called without creating an object.
What type of method requires an instance of its class to be invoked?
Think about methods that act on specific objects.
Static methods can:
Remember the characteristics of static methods.
Design a class representing a bank account with methods for deposit, withdrawal, and a static method to compare two accounts based on balance.
Think about how operations will affect the account state.
Create a program using a static method to calculate the area of a rectangle, and an instance method to set dimensions. Explain why you chose static for area.
Consider operations that don't need specific instance details.
6 more questions in this section. Enroll free to practise them all.
Enroll free