In Java Identifiers are used to identifies the class name, variable name, method name, package name, constant name, and so on ...
Java cannot be use the reserved words as
Identifiers.
For Every Identifier there is some
meaning in java Program ,that may be user or Predefined variable,class,method
,interface…
Follow the Rules for Identifiers in Java,to
declare Identifiers Following are some rules and conventions:
1.Valid identifier must have characters
[A-Z] or [a-z] or numbers [0-9],
and underscore(_) or a dollar sign ($).
2.Identifier should not contain any space
3.Should not start An identifier as a
number at the starting.
4.An identifier should be of length 4-15
letters only. However, there is no limit on its length. But, it is good programming
practice to follow the java naming conventions.
5.We can't use the Java reserved keywords
as an identifier such as int, float, double, char, etc. For example, int double
is an invalid identifier in Java.
Examples:
@CitizenService is not a valid identifier
because it contains a special character which is @-->Rule(1).
Citizen Service is an invalid identifieràRule(2)
123CitizenService is an invalid
identifierà(3)
No comments:
Post a Comment
Thank you Very Much.For Given Comment