Lessons

Java tutorial

Java Variables

A variable is a named place to store a value. You choose a type, give it a name, and assign a value with =. Later lines can read the name or replace the value.

Example

Edit the code and run it again. This runner stays in your browser and covers the syntax used in these lessons.

Output

Run the example to see output here.

What this code does

language keeps the text Java. year starts at 1995 and is then changed to 2026, so the printed number is the new value.