Week 1 · Thursday, Jan 7 · 1.4
Variables and data types
A variable is a named storage spot with a type: int holds whole numbers, double holds real numbers, boolean holds true or false, and a String variable refers to an object that holds text.
Minutes for each part of a 90-minute class.
Today we will
- A variable is a named storage spot. Its data type says which values fit in it.
- The three primitive types: int for whole numbers, double for real numbers, boolean for true or false.
- String is a reference type. A String variable refers to an object that holds the text.
- Declare a variable with its type and then its name. Initialize it by giving it a first value with =.
- Read a description and pick the best type. Then spot declarations that will not compile, and say why.
Terms
AP topics 1.2 · Learning objectives 1.2.A, 1.2.B · Skills 1.A, 2.A, 3.A, 3.D
Demonstration
Chromebooks open. Follow along on the Follow along jobs in We Do / You Do while Mr. Muggivan works the examples.
We Do / You Do
Follow along, then Part A (with help), Part B (on your own) and stretch. One code for the whole block.
Open We Do / You DoExit Ticket
A few exam-style items to show what you learned today. One code.
Opens only in the last 15 minutes of class on this day.
Missed class? The Do Now and We Do / You Do stay open. Do them any time and submit your codes.