Declaring String Variables and Using String Literals
Overview
In this lesson, students will use reference data by declaring and initializing String
objects.
Learning Objectives
- 1.1.B.2 Distinguish between primitive data types and non-primitive data types (objects), including
String
.
- 1.1.B.4 Declare and create variables of specific types.
- 1.1.B.5 Assign values to variables.
Skills
- S1.C Explain the impact design has on data storage.
- S2.A Write program code and implement algorithms.
Student Outcomes
Students will be able to:
- recognize when to use a
String
data.
- declare and initialize variables for
String
data.
Duration: 0.5 class period
Resources
Warm-up / Motivate
As students are entering your classroom provide them with a cookie cutter and playdough. Or have a table at the front of the classroom with playdough of different colors and have students use a cookie cutter to stamp out different objects. There will be several cut out shapes. These would be instances or objects created by the cookie cutter blue print which would be considered a class. You can ask students to identify differences between the cut out shapes. They are maybe different thicknesses or colors. These attributes represent the data that defines the objects. You can revisit this activity when deepening the understanding of the relationship between classes and objects.
Learn
Either as a group or on their own, have students review tutorial: Learn: Declaring Strings
Next Lesson
Lesson Plan: Mutable vs. Immutable Data