Skip Top Navigation Bar

Creating Record Objects and Calling Methods

Overview

In this lesson, students will learn how to create objects of a record type and call methods on these records.

Learning Objectives

Skills

Student Outcomes

Students will be able to:

Duration: 1 class period

Resources

Warm-up / Motivate

As students enter the room, provide them with an index card that contains descriptions for records. Have the students write the record.

Some example descriptions might be:

  1. Record to represent a City that contains the State/Province and Country.
  2. Record to represent a Student that contains their student id number, first name, and last name.
  3. Record to represent a Hurricane that contains the name of the hurricane, date it made landfall, and size (scale of 1 - 5).

If students need assistance, they can refer back to Learn: Introduction to Records

Learn

Either as a group or on their own, have students complete tutorial: Learn: Creating Objects of a Record and Calling Methods

Practice

Wrap-up / Extension

Have students revisit the Records they created when they entered the classroom. Have them complete the following:

  1. Identify the instance variables, constructor, and methods.
  2. Create an object of the record type.
  3. Write a call to one of the methods.