Java Variables
Variables are data name that may be used to store a value. Variable may take different values at different times during execution.
Variables are may refer to some data types which are like int, float, char and etc.
Every variable in Java language has a specific type that determines the layout and size of the variable’s memory. The ranges of the values that can store with the memory and set of operations that can apply to the variable.

Syntax of variables
type variable_list;
Types of variables
- Local variable
- Instance Variable
- Static variable
Local variable
It defines within a block or method or constructor is called a local variable. These variables won’t work outside of the method or constructor.
void function(){ int a=10; // Local variable }
Instance Variables
These variables are non-static variables and are declared in a class outside any type of method, constructor or block.
class A { static int b=10; //static variable int c=5; //instance variable void function1(){ int a=10; //local variable }
Static Variable
Static Variable is declared with static keyword.
class A { static int b=10; //static variable void function1(){ int a=10; //local variable }
Quickly Find What You Are Looking For
Onlinetpoint is optimized for basic learning, practice and more. Examples are well checked and working examples available on this website but we can't give assurity for 100% correctness of all the content. This site under copyright content belongs to Onlinetpoint. You agree to have read and accepted our terms of use, cookie and privacy policy.