Java Design Pattern
Introduction to Java 10
Introduction to Java 11
Introduction to Java 12

Java Identifiers and Reserved Words

Any name injava program is called as identifiers. It may be a variable name, a method name, a class etc.

Example:
Class Test
{
	public Static void main(String[] args)
	{
		int X=10;
	}
}

NOTE: ALL THE ABOVE ARE IDENTIFIERS.
RULES & REGULATIONS FOR DECLARING AN IDENTIFIER:

1. The following allowed characters can be taken to declare as identifiers.


A-Z
a-z
0-9

_ (underscore)

2. To declare an identifier the first character shouldnot be digit.
Ex: 1234sum (invalid)

$_$_$_ (valid)

3. Reserved words never consider as identifiers
Ex: int x=10; (valid)

Int if =10;(invalid)

4. All inbuilt class & interfaces can be considered as identifier, but it is not recommended because the readability of the code reduce.

Example:
int String=10;
System.out.println(String) ;  // 10
Here String is a valid identifier but not recomnded.
int Runnable=20;
System.out.println(Runnable);  //20


Here Runnable(an inbuilt interface) is a valid identifier, but not recommended.
5. There is no length limit of identifier.
Exa: int xxxxxxxxxxxyyyyyxz=10;

Reserved Words:

reserve_keywords

About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.


We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc






 PreviousNext