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 say that a local variable can be used only in the block where it is declared. (Guide: “Local variables”; Practice Question 1)
- I can explain why parameters are local variables and cannot be public or private. (Guide: “Local variables”; Practice Question 2)
- I can say where instance variables and class variables can be used. (Guide: “Instance variables and class variables”; Practice Question 7)
- I can explain what a block is. (Guide: “Local variables”; Practice Question 7)
Skills
- I can state the scope of each variable in a method with nested blocks. (Guide: Figure 1; Practice Question 7)
- I can find the cannot-find-symbol errors in code that uses a variable outside its block. (Guide: Worked example 2; Practice Question 5)
- I can trace code in which a parameter or local variable hides an instance variable. (Guide: Worked example 1; Practice Questions 4 and 6)
- I can repair a constructor that contains name = name. (Guide: “When two variables share a name”; Practice Question 8)
Reasoning
- I can explain why a buggy constructor leaves instance variables at their defaults. (Guide: “When two variables share a name”; Practice Questions 3 and 8)
- I can explain why a changed local variable does not change an object’s state. (Guide: Worked example 1; Practice Question 9)
- I can tell the difference between scope and public or private access. (Guide: “Common misconceptions”)
All ticked? Move on to the Topic 3.9 study guide, this Keyword, or return to the course roadmap.