what is a indentifier

what is a indentifier

View Answers

September 29, 2008 at 10:25 AM

An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter. An identifier cannot have the same spelling (Unicode character sequence) as a keyword, boolean literal, or the null literal.

Identifier:
IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral

IdentifierChars:
JavaLetter
IdentifierChars JavaLetterOrDigit

JavaLetter:
any Unicode character that is a Java letter (see below)

JavaLetterOrDigit:
any Unicode character that is a Java letter-or-digit (see below)

Letters and digits may be drawn from the entire Unicode character set, which supports most writing scripts in use in the world today, including the large sets for Chinese, Japanese, and Korean. This allows programmers to use identifiers in their programs that are written in their native languages.
A "Java letter" is a character for which the method Character.isJavaIdentifierStart(int) returns true. A "Java letter-or-digit" is a character for which the method Character.isJavaIdentifierPart(int) returns true.

The Java letters include uppercase and lowercase ASCII Latin letters A-Z (\u0041-\u005a), and a-z (\u0061-\u007a), and, for historical reasons, the ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024). The $ character should be used only in mechanically generated source code or, rarely, to access preexisting names on legacy systems.

The "Java digits" include the ASCII digits 0-9 (\u0030-\u0039).

Two identifiers are the same only if they are identical, that is, have the same Unicode character for each letter or digit.

Identifiers that have the same external appearance may yet be different. For example, the identifiers consisting of the single letters LATIN CAPITAL LETTER A (A, \u0041), LATIN SMALL LETTER A (a, \u0061), GREEK CAPITAL LETTER ALPHA (A, \u0391), CYRILLIC SMALL LETTER A (a, \u0430) and MATHEMATICAL BOLD ITALIC SMALL A (a, \ud835\udc82) are all different.

Unicode composite characters are different from the decomposed characters. For example, a LATIN CAPITAL LETTER A ACUTE (Á, \u00c1) could be considered to be the same as a LATIN CAPITAL LETTER A (A, \u0041) immediately followed by a NON-SPACING ACUTE (´, \u0301) when sorting, but these are different in identifiers. See The Unicode Standard, Volume 1, pages 412ff for details about decomposition, and see pages 626-627 of that work for details about sorting. Examples of identifiers are:

String
i3
MAX_VALUE
isLetterOrDigit



Rajanikant

September 29, 2008 at 11:02 AM

Hi friend,

Identifiers are the names of variables, methods, classes, packages and interfaces. In the HelloWorld program, HelloWorld, String, args, main and println are identifiers.

Identifiers must comply with these rules:

* The first character of an identifier must be a letter, an underscore(_), or a dollar sign($).
* The rest of the characters in the identifier can be a letter, underscore, dollar sign, or digit. Note that spaces are NOT allowed in identifiers.
* Identifiers are case-sensitive. This means that age and Age are different identifiers.
* Identifiers cannot match any of Java's reserved words.

Examples:

These identifiers are valid:

MyClass
$amount
totalGrades;
TotalGrades;
TAX_RATE
one

These identifiers are NOT valid:

My Class // spaces are not allowed
numberOf*s // the asterisk cannot be used
final // final is a reserved word
1Way // identifiers cannot start with a digit


--------------------------------------------------------------------


Visit for more information.

http://www.roseindia.net/java/

Thanks

Amardeep.









Related Tutorials/Questions & Answers:
what is a indentifier - Java Beginners
what is a indentifier  What is an identifier and what is the definition?  An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter. An identifier cannot
what is bit
what is bit  what is bit
Advertisements
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection  what is hibernate.archive.autodetection? what is autodetection and why it is used
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection  what is hibernate.archive.autodetection? what is autodetection and why it is used
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection  what is hibernate.archive.autodetection? what is autodetection and why it is used
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection  what is hibernate.archive.autodetection? what is autodetection and why it is used
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection  what is hibernate.archive.autodetection? what is autodetection and why it is used
What is procedure
What is procedure  What is procedure in computers? What are the primary categories of procedures
what is hibernate.archive.autodetection
what is hibernate.archive.autodetection  what is hibernate.archive.autodetection? what is autodetection and why it is used
What is Hibernate
What is Hibernate  Hi, What is Hibernate? Thanks
What is Hibernate
What is Hibernate  Hi, What is Hibernate? Thanks
What is JDBC?
What is JDBC?  What is JDBC
What is FBT
What is FBT   hello, What is FBT
What is ActionServlet?
What is ActionServlet?  What is ActionServlet
What is Trigger?
What is Trigger?  What is Trigger
What is VLR ?
What is VLR ?  hii, What is VLR
What's PHP ?
What's PHP ?  What's PHP
What is an interface?
What is an interface?  What is an interface
What is DML?
What is DML?  What is DML
What is Index?
What is Index?  What is Index
What is SQLLoader?
What is SQLLoader?  What is SQLLoader
What is a "constraint"?
What is a "constraint"?  What is a "constraint
what is Savepoint ?
what is Savepoint ?  what is Savepoint
What is this keyword?
What is this keyword?  What is this keyword
what is collections?
what is collections?  what is collections
what are indices?
what are indices?  what are indices
What is Hibernate
What is Hibernate  Hi, What is Hibernate? Thanks
What is Hibernate
What is Hibernate  Hi, What is Hibernate? Thanks
What is Externalizable?
What is Externalizable?   Hi, What is Externalizable? Thanks
What is the % operator?
What is the % operator?   Hi, What is the % operator? thanks
What is casting?
What is casting?   Hi, What is casting? thanks
What is IOC ?
What is IOC ?  HI, What is IOC or Dependency Injection? Thanks
What is SQLExceptionTranslator?
What is SQLExceptionTranslator?  Hi, What is SQLExceptionTranslator? Thanks
What is DataAccessException?
What is DataAccessException?  Hi, What is DataAccessException? thanks
What are Struts?
What are Struts?  What are Struts? Can anyone explain me what are the Struts framework and what are its uses? Thanks
What is WAP?
What is WAP?  What is WAP?   Hi, Check the tutorial: What is WAP? Thanks
What is SPOOL?
What is SPOOL?  What is SPOOL?   SPOOL command stores output to a file
What is CRM?
What is CRM?  Can anyone tell me What is CRM? Thanks
What is webservices?
What is webservices?  What is web-services and what are the different types of web-services? It would be great if someone explain me the difference between these types of web-services in Java
What is Ajax?
What is Ajax?  Hi, What is Ajax and what is use of Ajax in web programming? Thanks   Hi, Ajax stands for AJAX stands for Asynchronous... JavaScript and other technologies such as CSS and XML. Read more at What is Ajax
What is NSRangeException
What is NSRangeException  Can anyone explain the NSRangeException and the reason why it occurs
What is portal
What is portal  What is portal What is portal and how can i create a portal in Java using components like Java and Java servlet? What are the elements of a portal and how can i create sigle request portal page in Java
what is posting?
what is posting?  what is posting?   Posting is an event that writes Inserts, Updates & Deletes in the forms to the database but not committing these transactions to the database
What is a tuple?
What is a tuple?  What is a tuple?   hi, A tuple is an instance of data within a relational database.ADS_TO_REPLACE_1 Thanks
What is workflow
What is workflow  hello, What is workflow in RUP?   hi,ADS_TO_REPLACE_1 A workflow is a sequence of activities that produces a result observable value
what is RUP?
what is RUP?  hello, what is RUP??   hii,ADS_TO_REPLACE_1 RUP is stands for Rational Unified Process
What was ENIAC
What was ENIAC  What was ENIAC?   ENIAC was first electronic computer. Full form of ENIAC is Electronic Numerical Integrator And Computer
What is an Iterator?
What is an Iterator?  Hi, What is an Iterator? Please help me. Thanks   Hi, I have find good reference website for the What is iterator? In this programming tutorial it explain how to use the iterator interface
What is WSP?
What is WSP?  hii, What is WSP?   hello,,ADS_TO_REPLACE_1 Wireless Session Protocol (WSP) implements session services of WAP. Sessions can be connection-oriented and connectionless and they may be suspended
What is CDPD ?
What is CDPD ?  Hello, What is CDPD ?   hii,ADS_TO_REPLACE_1 Cellular Digital Packet Data (CDPD) is an open standard for supporting wireless Internet access from cellular devices

Ads