Identifier:-
The name we choose for a variable is called an identifier.
An identifier can be of any length but it must begin with an alphabet,
underscore or ‘$’ the rest of an
identifier can include digit also.
Operators and spaces are not allowed in an identifier. We can’t use java keyword also. Keywords are words that are an essential part of java. Java is case sensitive language.
Operators and spaces are not allowed in an identifier. We can’t use java keyword also. Keywords are words that are an essential part of java. Java is case sensitive language.
Name of class should start with capital letter only.
e.g.
max, Max, maX, MAX all are different
ab$cd right
ab_123 right
_abcd right
ab+cd wrong
ab@cd wrong
_ab123 right
123ab wrong
while wrong it is a keyword
While right
Literals:-
Explicit data values that appear in our program are called
literals.
int a = 25; here a is variable and 25 is literal.
int a = 25; here a is variable and 25 is literal.
Constant:-
If a variable is declared final its value can’t be changed
final int MAX=100; constant name should be in capitals only.
final int MAX=100; constant name should be in capitals only.
No comments:
Post a Comment