Variable in Java

Variable in Java

Variables is the name of  reserved area allocated in memory.
Identifier are those whose value will change during execution of the program.

Rules:

  • First letter must be and alphabet.
  • Length can be up to 32 characters.
  • No special character is allowed except underscore (_).
  • No keyword to be used.

Local Variable: Declared within the body of method.
Instance Variable: The variable which is associated with the object of that class.
Static Variable: The variable which is associated with a class, not the object of the class.(Eg: used in counting of the object)


Comments

Popular posts from this blog

Constant in Java

Java History, Features and Application types