From our school days, we have an intuitive understanding of what a variable is. We think of it as a name that represents a value. We solve problems using such variables as x gallons of water or n miles of a distance, and similar. In Java, the name of a variable is called an identifier and can be constructed by certain rules. Using an identifier, a variable can be declared (defined) and initialized.
Identifiers and variables
Identifier
According to Java Language Specification (https://docs.oracle.com/javase/specs), an identifier (a variable name) can be a sequence of Unicode characters that represent letters, digits 0-9, a dollar sign ($), or an underscore (_).
Other limitations are as follows:
- The first symbol of an identifier...