Identifiers in Java, Variables declaration in Java, How to Declare Variables in Java
The Identifiers(Variables) are used to store the data in any programming language and the use of Identifiers are same in java like other languages. Identifiers are the combination of letters, digits, underscores(_) and dollar signs($).
Rules for constructing Identifiers in Java
The Identifiers(Variables) are used to store the data in any programming language and the use of Identifiers are same in java like other languages. Identifiers are the combination of letters, digits, underscores(_) and dollar signs($).
Rules for constructing Identifiers in Java
- An identifier is a sequence of characters that consists of letters, digits, underscores (_), and dollar signs ($).
- An identifier must start with a letter, an underscore (_), or a dollar sign ($). It cannot start with a digit.
- An identifier cannot be a reserved word. (See Appendix A, “Java Keywords,” for a list of reserved words.)
- An identifier cannot be true, false, or null.
- An identifier cannot be a keyword.
- An identifier can be of any length.
- An Identifier should have its data type.
Examples of valid variables declaration
double radious=1.0;
double area=radious*radious*3.14159;
String data="Hello Identifier";
int value=30;
int roll_no=1001;
String permanent_add;
Examples of invalid variables declaration
double 1radious=1.0;
double @area=radious*radious*3.14159;
String da.ta="Hello Identifier";
int val&ue=30;
int roll#no=1001;
String permanent*add;
{ 0 comments... read them below or add one }
Post a Comment