Tuesday, February 2, 2016

Java Identifiers Part 1

Hi All...!

To I'm going to teach you guys what are the Java Identifiers, Java Identifiers are names of Java classes, interfaces, variables, methods, packages, objects and constants.

There is some rules and regulations to follow when we create names (Identifiers). If we break those rules it will cause to compilation errors but if we don't follow the regulations it will make our code difficult to read and also difficult to maintain and modify.

Let's take a look at what are those rules we must follow when creating a Identifier.

  1. We can't use spaces in Java identifiers.
  2. We can't use spacial characters like !@#%^&*() in Java identifiers. 
  3. We can't use Java Key-words as identifiers.(you can find Key-word chart bellow)
  4. We can only use a letter, _, $ to start identifier.
  5. After we start a identifier by using a letter, _, $ we can use any combinations of letters, _, $ and NUMBERS
If we follow above rule we can create a legal identifiers.



Let's take a look at some examples,


No comments:

Post a Comment