8:07 pm - Thursday April 25, 2019

Identifiers in java with Example Program

Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044


  •   Identifiers must start with a letter, a currency character ($), or a connecting
  •   Character such as the underscore ( _ ). Identifiers cannot start with a number!
  •  After the first character, identifiers can contain any combination of letters,
  •   Currency characters, connecting characters, or numbers.
  •   Identifiers in Java are case-sensitive
  •  You can’t use a Java keyword as an identifier
  •  there is no limit to the number of characters an identifier can contain.
  •  JavaBeans methods must be named using camelCase, and depending on the


method’s purpose, must start with set, get, is, add, or remove.


legal and illegal identifiers


Legal identifiers:


int _a;

int $c;

int ______2_w;

int _$;


The following are illegal (it’s your job to recognize why):


int :b;

int -d;

int e#;

int .f;

int 7g;


Filed in: Z-A All Java Codes

No comments yet.

Leave a Reply