Part 1: Java Identifiers
Identifers in Java are by itself considered to be a name. Java Identifiers are nothing but a class , label, variable, and method names.
class FooBar {
public static void main(String [] args) {
String message=”Hello World”;
System.out.println(message); }
}
Here, FooBar, main, args, message are Identifiers in Java.
Rules/Naming Conventions for Java Identifier:
Alphabet Symbols : A to Z / a to z
Dollar: $
Underscore : _
Digits : 0 to 9
Get Vikas’s stories in your inbox
Join Medium for free to get updates from this writer.
Valid/Invalid Identifiers:
share567 {valid}
123tiger {Invalid}
lion2Tiger {valid}
4dinosaurElephant {Invalid}
cat@Symbol {Invalid}
dog#Value {Invalid}
__$alpha {Valid}$stockMarket {Valid}
We can use reserved keywords along with predefined java class names as Identifiers:
Ex:
class Practice{
int String=20;
float StringBuffer=2.2f;
}
Here, String and StringBuffer are the predefined classes in java
Java is a case-sensitive programming language.






