Parameters

Parameters are values that are being sent as input to a method. The variable that represent the parameter can be used to alter the value of it if it’s not declared as final.
A parameter can be sent by value or by reference. Any primitive datatype (like int, long, double) is sent by value, whereas any object (like Array, List, Set) is sent by reference.

Continue reading

Local Variables

Local variables are fields declared in a specific method of a particular class.
They’re much like instance variables (see Instance variables) but they are not declared with any access modifiers since the can never be reached outside of the method they are declared in.
This is an example of a local variable:

Continue reading

Class variables

Class variables are fields in a class that are declared as static which means that it belongs to the particular class, not any objects that are instantiated from that class.
It also means that the value of the class variable is the same in every object created from that class.
A class variable can have one and only one value no matter how many objects that are created from it.

Continue reading