type variableName = value;
Where type is one of Java’s types (such as int or String), and variableName is the
name of the variable (such as x or name). The equal sign is used to assign values
to the variable.
Syntax
These unique names are called
Identifiers
The general rules for naming variables are:
Kinds of Variables
____ variables are declared in methods, constructors, or blocks. _____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. Access modifiers cannot be used for _____
Local Variable
_____ variables are declared in a class, but outside a method, constructor or any block. _____ variables are created when an object is created with the use of the keyword ‘new’ and
destroyed when the object is destroyed. Access modifiers can be given for _____
Instance Variable
Static Variable
Class variables also known as _____ variables are declared with the static keyword in a class, but outside
a method, constructor or a block. _____ variables can be accessed by calling with the class name ClassName.VariableName.