Java

CamelCase Notation- Naming Convention for Programming Languages

CamelCase is the practice of writing compound words or phrases in which the words are joined without spaces and are capitalized within the compound like BreakFast, myName etc. CamelCase is so named because each word in the identifier is put together without spaces, but with the first letter of each word captilised, looking like humps of a camel.

There are two varieties in CamelCase:
UpperCamelCase
lowerCamelCase

In Java variables, references, method names are declared in lowerCamelCase.

//Variable declared using lowerCamelCase
int animalCount;

//Method defined using UpperCamelCase
public abstract int getAnimalCount();

UpperCamleCase is also called as Pascal Notation. The only difference between the LowerCamelCase and UpperCamelCase (Pascal Notation) is that the first letter of the compound word is capitalized in case of UpperCamelCase while it is not in case of lowerCamelCase. In Java class names are declared in UpperCamelCase notation.

/*
Observe the UpperCamelCase notation used 
for declaring the class name
*/
class AnimalTest 
{
  String name;
  public AnimalTest(String name)
  {
    this.name=name;
  }
}

Read more on Java Programming Style Guide here.

For more information on the CamelCase notation here.

Advertisements

3 replies »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s