Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What does the static keyword signify?
Think about how a class and its instances interact.
Can you name a common use of static methods?
Think of functions that perform calculations.
What does the static keyword indicate about a class member?
Think about whether the member is shared or unique.
True or False: Static variables are created for each instance of a class.
Consider how many copies exist for shared data.
Create a class called Library that counts the number of books added to it using a static variable. Write methods to add a book and display the total count.
Think about how each addition of a book should affect a shared count.
Explain how changing a static variable from an instance method could lead to side effects. Provide an example to illustrate.
Consider how one instance's change could impact others.
5 more questions in this section. Enroll free to practise them all.
Enroll free