Work through the list without notes. If you cannot do a statement, follow its link, then come back. Guide = study guide; Practice = practice questions; see also the revision notes.
Understanding
- I can explain that all objects share one copy of a class variable but each has its own instance variables. (Guide: “Class variables”; Practice Questions 1 and 9)
- I can state what a class method can and cannot access. (Guide: “Class methods”; Practice Question 3)
- I can explain what final does and why constants are public static final. (Guide: “Class variables”; Practice Question 5)
- I can explain why a class method can be called without creating an object, and how to call my own. (Guide: “Class methods”; Practice Question 6)
Skills
- I can declare a class variable and a class method with the static keyword. (Guide: Worked example 1; Practice Question 7)
- I can use a class variable to count objects or give each a unique id. (Guide: Worked example 1; Practice Questions 2 and 7)
- I can trace code that updates both instance and class variables. (Guide: Worked example 2, Part A; Practice Question 4)
- I can access a public class variable or method with the class name and dot operator. (Guide: Worked example 2, Part B; Practice Question 6)
Reasoning
- I can identify the compile errors caused by instance variables or methods in a static context. (Guide: Worked example 2, Part C; Practice Questions 3 and 8)
- I can decide whether an attribute should be an instance variable or a class variable from its description. (Guide: “Two kinds of attribute”; Practice Question 9)
- I can explain why a constructor should update, not reset, a shared counter. (Guide: “Common misconceptions”; Practice Question 7)
All ticked? Move on to the Topic 3.8 study guide, Scope and Access, or return to the course roadmap.