Variables in Java

A variable is a container that holds data which can be used and manipulated within the program. Variables must be declared with a data type before being used.

Syntax:

dataType variableName = value

Example:

int age = 25;
String name = "Alice";