Declaring and Initialing Variables
Overview
In this lesson, students will begin to develop an understanding of the different types of data that are stored by the computer.
Learning Objectives
- 1.1.B.3 Identify variable names for data that are descriptive, meaningful, and conform to the rules of the language.
- 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:
- determine the type of variable that is needed.
- identify a variable name that is descriptive.
- declare and create a primitive local variable.
- provide an intial value to a primitive local variable.
Duration: 1 class period
Resources
Warm-up / Motivation
As students have seen throughout the first several lessons, data is critical to all programs. This lesson will teach them how to declare variables and store data.
Learn
- Either as a group or on their own, review the tutorial: Learn: Declaring and Initializing Variables
- Review the examples of variable names to answer any questions.
- Review the declaring and initalizing variables examples to answer any questions.
- Ensure students have time to practice using the Java Playground.
Practice
Have students complete the practice: Practice: Declaring and Initializing Variables Practice
Wrap-up / Extensions
Have students revisit their data identifying activities from earlier and expand on that to create variables. They should consider the name and ensure that it will be descriptive of the value it will hold and consider the initial value that will be stored.
Next Lesson
Lesson Plan: Declaring String Variables and Using String Literals