Java Variables

Last Updated: March 19, 2022

Java Variable Syntax

type var-name;

where type is the data type of the variable, and var-name is its name.

You can define variables for any valid data types in Java.

The type of the variable can not be changed during the lifetime of the variable.

Scope and lifetime of a Java variable