Your First Variable
A variable is like a labeled box. You give it a name and put a value inside.
Here's what that looks like:
int age = 25;
That means: create a box called age that stores a whole number (int), and put 25 in it.
The variable already exists. Change its value from 25 to 30.
void main() {
int age = 25;
IO.println(age);
}
When you write int age = 25;, Java sets aside exactly 4 bytes (32 bits) of memory and stores the value 25 there as a binary number.
The name age is just a label for you — the compiled bytecode works with a numbered slot in the method's stack frame instead. The name only survives as optional debug info.
int can store values from about -2.1 billion to +2.1 billion. For bigger numbers: long (8 bytes).