legal identifiers: : identifier « Java Source And Data Type « SCJP






public class MainClass {
  public static void main(String[] argv) {
    int _a;
    int $c;
    int ______2_w;
    int _$;
    int this_is_a_very_long_identifier;
    int myIdentifier;
    int $my_identifier;
    int $123;
  }
}
/*    
illegal (it's your job to recognize why):

int :b;
int -d;
int e#;
int .f;
int 7g;


*/








1.6.identifier
1.6.1.Java Identifiers
1.6.2.Java names always considers case.
1.6.3.legal identifiers:
1.6.4.Java Keywords and Reserved Words
1.6.5.An identifier is a word used by a programmer to name a variable, method, class, or label.
1.6.6.Keywords and reserved words may not be used as identifiers.
1.6.7.An identifier must begin with a letter, a dollar sign ($), or an underscore (_)
1.6.8.Identifier's Subsequent characters may be letters, dollar signs, underscores, or digits.
1.6.9.The only nonalphabetic characters allowed to start a name are $ and _(underscore).
1.6.10.Embedded keywords are ok
1.6.11.Illegal identifier: starts with a digit
1.6.12.Illegal Identifier: bad 1st char
1.6.13.The following are invalid Java identifiers:
1.6.14.A simple identifier followed by an expression