Identifier
Author: Ravi Poswal
An identifier is a name that is used to uniquely identify and refer to a variable, class, method, package, or any other user-defined object within the code.
- i. It needs to begin with a lowercase letter.
- ii. It can start with a special character except &(ampersand), $(dollar), and _(underscore) except for another special character.
- iii. It can’t use space between the identifier name.
1. Variable
A variable is a container that holds a value of data while a program is running. Every variable has to have a distinct name and a particular data type. these are three type:
i. Instance variable (without static)
ii. Global variable (with static)
iii. Local variable
i. Instance variable (without static)
Declared within the class but outside of the methods. It is full class accessibility. This variable must be used through the object.
Code Example
class A
{ int a=5; //instance variable without static
public static void main(String arg[]) {
A f=new A();
System.out.println("instance variable", +f.a);
} }
RANREV INFOTECH