Tuesday, August 20, 2019

Identifiers in JAVA

any name in the java program like variable name,class name,method name,interface name is called identifier.

class Test Test-------identifier
{
void add() add-------identifier
{
int a=10; a----------identifiers
int b=20; b----------identifiers
}
};

Rules to declare identifiers:

the java identifiers should not start with numbers,it may start with alphabet symbol and underscore symbol and dollar symbol.

a. Int abc=10;-----valid
b. Int 2abc=20;----not valid
c. Int _abc=30;----valid
d. Int $abc=40;----valid

e. Int @abc=50;---not valid

The identifier will not contains symbols like

+ , - , . , @ , # , *………………….

The identifier should not duplicated.

class Test
{
void add()
{
int a=10;
int a=20; the identifier should not be duplicated.
}

};

In the java applications it is possible to declare all the predefined class names and predefined interfaces names as a identifier. But it is not recommend to use.

class Test
{
public static void main(String[] args)
{
int String=10; //predefind String class
int Serializable=20; //predified Seriaiable class
float Exception=10.2f; //predefined Exception class
System.out.println(String);
System.out.println(Serializable);
System.out.println(Exception);
}

};



No comments:

Post a Comment

AME (Approval Management Engine)

AME (Approval Management Engine) : AME Stands for Oracle Approval Management Engine. AME is a self service web application that enables...