To compute anything, a program needs to store values. A variable is named storage for a value of a given type. This notebook is about declaring one.
A declaration gives a type, a name, and a starting value: int score = 10;. The = means assign — put the value into the variable — not equals.
int score = 10;
=
int score = 10; System.out.println(score); // 10
The name score now stands for the value 10.
score
▶ Try it: run this, then change something and run it again.
Assemble a statement that declares score with the value 10.
Fill the blank so score holds the whole number 10.
What does this print?
int age = 30; System.out.println(age);
Type exactly what this prints:
int x = 7; System.out.println(x);
Click the operator that puts the value into the variable.