Variables/Identifiers in Java Part . 8
Variables/Identifier in Java
Identifiers are used in java program for Identification purpose.
Whatever the name we are using in java program is called as Identifier It can class Name , Method Name, Variable Name.
Question = Why we use Identifiers?
Answer = TO Identification purpose.
1 – The valid characters in java Identifiers are :
a – z, A – Z, 0 – 9, underscore (_), dollar symbol ($).
2 – Identifiers should not start from Digit :
3 – No length Restriction but choose short name as Identifiers.
4 – Java Identifiers are case sensitive.
5 – we can’t use keywords/reserved word as Identifiers.
int if=10; [invalid]
int double=10; [valid]
class class=10; [invalid]
6 – All predefine classes and Identifiers are allowed to use as Identifiers.
int Runnable=30; //valid Runnable is predefined interface.
Note :- from java 9 version on word ,_(underscore) is keyword then we can not use as Identifier.
Ex – int_=10; (java 8)is valid.
int_=10; (java 8)is invalid.
We can’t say keywords as identifiers.
Question = Which of following valid identifiers in java 11?
Answer = int _a=15; [valid]
Int __d=30; [valid]
int _=35; [invalid]
How many identifiers are present in this program ——
Total five identifiers in this program (Test, main, string, ar, x)
Now Friends If you like this post please tell us how can we help you to provide better knowledge?
If this post is use full for you please share the post with your friends.
Please follow as facebook : www.facebook.com
Please follow as twitter : www.twitter.com
And more information please visit here : www.weindians.in
Please Subscribe on youtube : www.youtube.com