All Posts

Java Identifiers

Java Identifiers

In Java, an identifier is the name assigned to a class, method, variable, or interface. It must follow specific rules to be valid.

Java Identifier Rules

  • Identifiers must start with an alphabet (A-Z, a-z), the dollar sign ($), or an underscore (_).
  • Identifiers can contain alphabets, digits (0-9), $, and _.
  • Identifiers cannot contain special characters (e.g., @, #, %, &).
  • Identifiers are case-sensitive.

Examples of Valid Identifiers

Some examples of valid identifiers are as follows:

  • i
  • book
  • author1
  • BankAccount

 

Java Tutorials

Java Tutorial on this website: