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 the difference between a void and a non-void method and write the header for each. (Guide: “Void and non-void methods”; Practice Question 1)
- I can explain what return by value means. (Guide: “Void and non-void methods”; Practice Question 3)
- I can explain what a return statement does to the flow of control, including inside an if or a loop. (Guide: “What return does to the flow of control”; Practice Questions 2 and 5)
- I can say what an accessor and a mutator each do. (Guide: “Accessors and mutators”; Practice Question 7)
Skills
- I can write accessor, mutator and calculation methods from a specification. (Guide: Worked example 1; Practice Question 7)
- I can trace a method call line by line and state the value returned and the change to the object. (Guide: Worked examples 1 and 2; Practice Questions 3 and 5)
- I can predict the effect of changing a primitive parameter inside a method. (Guide: Worked example 2; Practice Question 4)
- I can identify and fix missing returns, unreachable statements and wrong return types. (Guide: “Reading compile errors in methods”; Practice Questions 6 and 8)
Reasoning
- I can explain why a method that changes a primitive parameter does not change the caller’s variable. (Guide: “Parameters of primitive type”; Practice Question 4)
- I can state preconditions for a method and describe what happens when they are broken. (Guide: “Preconditions”; Practice Question 9)
- I can decide whether a method should be void or non-void from what the caller needs. (Practice Questions 1 and 7)
All ticked? Move on to the Topic 3.6 study guide, Methods: Passing and Returning References of an Object, or return to the course roadmap.