The java programming language defines the following types of variables.
1) Instance Variables.(Non Static Fields)
2) Class Variable (Static Fields)
3) Local Variables.
1) Instance Variables (Non Static Fields) Technically speaking, objects store their individual states in “non-static fields”, that is, fields declared without static keyword. Non static fields are known as instance variables because their values are unique to each instance of a class(to each object, in other words); the currentSpeed of one bicycle is independent from the currentSpeed of another.
2) Class Variables (Static Fields) A class variable is any field declare with the static modifier; this tells the compiler that there is exactly one copy of this variable in existence, regardless of how many times the class has been instantiated. A field defining the number of gears for a particular kind of bicycle could be marked as static since conceptually the same number of gears will apply to all instances.The code static int numGears=6; would create such a static field.
Additionally the final keyword could be added to indicate that the number of gears will never change.
3) Local Variables are the variables that are defined within the opening and closing brackets of a method.As such local variables are only visible to the methods in which they are declared, they are not accessible from the rest of the class.
Syntax (int i=0;)
4) Parameters are the variables that have been passed through methods as a arguments
int add(int a,int b)
In the above example int a, int b are the parameters.