Identifier in Java

Identifier is nothing but a name. In java language variable name is acting as a identifier. In java any name can be represented as a identifier, that name can be used to identify the particular things.

Example of identifier:

	
	variables name, methods name, class name, array name
	interface name etc.
	

How to make an identifier in java?

Every programming language have their own identifier rules. Java language also follow some rules.

Rules for identifier in Java

Example of valid identifier:


	int a; int abc; int _xyz; int btn123; int dfg_123; int $xyz; int x$yz;
	int numberseries; int large_number_series;
    

Example of invalid identifier:


	int 123; int 12abc; int xyz@; int num-value; int book name;
    

Example of case sensitive identifier:

	
    int num = 10;
    int Num = 20;
    int NUM = 30;
    

In above example you will see different-different variables and all variables have same name. They are different in just case sensitive way. So the output will be different.

Output:


    //output of the above example..
    10
    20
    30
    

Post Your Comment