Unit 5 Lesson 02 Writing Constructors Lesson Plan
Unit 5 Lesson 02 Writing Constructors Lesson Plan
Overview
This lesson explains the purpose of a constructor. Students will learn
how to write a no-argument constructor and constructors which
accept parameters. Students will also be challenged to write an entire
class, including instance variables, constructors, and a print method.
1
Lesson Plan
Lesson 5.2: Writing Constructors
Learning Activities
2
Lesson Plan
Lesson 5.2: Writing Constructors
○ Collect student papers and ensure all their questions are
eventually addressed in the lesson. If time, use these questions
at the end of the lesson during reflection time
● Experiences and Explorations (30 mins):
○ Ask students to complete the Check Your Understanding 5-2-1
and 5-2-2
○ ActiveCode 1 - Fraction Class
■ Have students work in pairs to look at the Fraction class
and predict the output BEFORE running the code
■ Allow them to run the code and discuss with their partner
about any differences between their predictions and the
actual output
■ Call on 2-3 students to share anything learned about their
output
○ Independent Practice: Have students complete ActiveCode 2
for the Car class to complete the two constructors and write the
code in the main method to create two Car objects, then show
solutions and ask for students to share any similarities or
differences between their code and teacher’s solution.
3
Lesson Plan
Lesson 5.2: Writing Constructors
● Student Questions: Review Exit activity to reflect on student
questions they wrote during opening activity
● Homework: Writing Constructors Homework Worksheet
● Common Misconceptions:
○ Students may try to give a return type or “void” in the
constructor’s header
○ When assigning parameter values to instance variables, students
often confuse which variable is being assigned a value and which
variable contains the value to be assigned (i.e. n = name;
instead of name = n;)
● Personal Progress Check (College Board): The College Board AP
Classroom provides a quiz bank and Personal Progress Checks. You
may create a formative assessment quiz for topic 5.2 in the AP
Classroom. Review the results in class to identify and address any
student misunderstandings.
Differentiation: Enrichment
● BeginnersBook: Constructors in Java - A Complete Study! Use this
reference for a thorough explanation of constructors along with examples.
Background Knowledge
● I’d Rather Be Writing - Java Constructors
● Oracle Java Tutorials - Providing Constructors for Your Classes
Teaching Tips
● CSP → CS A Tips
○ In Mobile CSP, specifically, objects were created in MIT App
Inventor by dragging items from the Palette into the Viewer while
4
Lesson Plan
Lesson 5.2: Writing Constructors
in the Designer View. Therefore, it was not necessary to include
any code for constructing an object.
○ Light and dark green puzzle pieces hold or set the values of
properties (instance variables), and purple blocks were actions
(like object methods).
● Tips for Encouraging Help Seeking