Featured Article aswini
featured article subtitle
- Sep 25, 2026
- web.pages.featuredarticle.minread
- credits: Shubham
Intro copy
A variable provides us with named storage that our programs can manipulate. Each variable in Java has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.

To declare more than one variable of the specified type, you can use a comma-separated list.
- Local variables are created when the method, constructor or block is entered and the variable will be destroyed once it exits the method, constructor, or block
- There is no default value for local variables, so local variables should be declared and an initial value should be assigned before the first use.
- Section title
web.pages.featuredarticle.sources
- You must declare all variables before they can be used. Java variables are declared by specifying the data type followed by the variable name. To assign a value, use the assignmentoperator followed by the value. Each declaration or initialization statement must end with a semicolon