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 define an object’s state and say what a has-a relationship means. (Guide: “An object has a state”; Practice Question 1)
- I can describe what happens in memory when
newcalls a constructor. (Guide: “What happens when you write new”; Practice Question 9) - I can state the default values for int, double, boolean and reference instance variables. (Guide: “The default constructor and default values”; Practice Question 2)
- I can explain when Java supplies the default constructor and when it does not. (Guide: same section; Practice Question 3)
Skills
- I can write constructors that initialise all instance variables from parameters. (Guide: “Constructor parameters”; Practice Question 7)
- I can write overloaded constructors and tell which one a call uses. (Guide: “Constructor parameters”; Practice Questions 3, 4 and 7)
- I can trace the state of an object through its constructor. (Guide: Worked example 1; Practice Question 4)
- I can write a constructor that stores a copy of a mutable parameter. (Guide: Worked example 2; Practice Question 8)
Reasoning
- I can predict output that depends on whether a constructor stored a reference or a copy. (Guide: Worked example 2; Practice Question 5)
- I can explain why a variable of a class type holds a reference, not the object. (Guide: “What happens when you write new”; Practice Question 9)
- I can find why a call to
newdoes not compile, such as avoidconstructor or a missing matching constructor. (Guide: “Common misconceptions”; Practice Questions 3 and 6)
All ticked? Move on to the Topic 3.5 study guide, Methods: How to Write Them, or return to the course roadmap.