KEMBAR78
3. Identifiers in Java | PDF
0% found this document useful (0 votes)
0 views1 page

3. Identifiers in Java

Identifiers in Java are names assigned to program elements like variables and methods, following specific naming rules such as starting with a letter, underscore, or dollar sign. Java also reserves three literal values: true, false, and null, which cannot be used as identifiers. These reserved literals are essential for representing boolean values and null references in the language.

Uploaded by

SachinJadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views1 page

3. Identifiers in Java

Identifiers in Java are names assigned to program elements like variables and methods, following specific naming rules such as starting with a letter, underscore, or dollar sign. Java also reserves three literal values: true, false, and null, which cannot be used as identifiers. These reserved literals are essential for representing boolean values and null references in the language.

Uploaded by

SachinJadhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

3.

Identifiers in Java
An identifier is the name you assign to elements in your program such as variables,
methods, classes, or other user-defined components. These names are used to
identify and refer these elements within the code. However, there are certain rules
that are strictly enforced by the Java compiler when naming identifiers.
Starting character — An identifier must begin with a letter (A–Z or a–z), an
underscore (_), or a dollar sign ($). It cannot begin with a digit (0–9).

Reserved Literals in Java


In addition to the keywords, Java also reserves three literal values: true, false,
and null. These are not keywords, but they are reserved words in the language.
true and false are the only boolean values in Java.
null represents the null reference, meaning an object that does not point to any
memory location.
Although they are not classified as keywords in the Java Language Specification,
they cannot be used as identifiers for variables, methods, classes, or any other
user-defined elements. These reserved literals have been part of Java since its
beginning.

You might also like