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.
Apart from camelCase we have:
– PascalCase – multiple words are capitalized (first letter being capital). C# uses this convention and in Java we use this for class or enum naming.
– kebab-case – multiple words are in the small case and separated by dash (-). Lisp language uses this convention. We also use this in naming the attributes in HTML. Like animal-name.
– Snake_case – multiple words separated by underscores (_). Like animal_name
Sponsored Text
Pro Programming Tip : Need to catch up with your programming work remotely? Get an instant remote access to all your essential programming tools such as emulators, IDE’s and SDK on your preferred device(PC/android/iOS) with citrix xendesktop from CloudDesktopOnline at the cheapest xendesktop pricing and plans. If you’re looking for a reliable and collaborative cloud platform then try MS Azure with managed azure services from Apps4Rent with 24 * 7 * 365 days top-notch tech-support and migration assistance.
In english is better :
Somthing wrong here, isn’t it ? getAnimalCount() >> UpperCamelCase
Its wrong:
Please see bellow:
public abstract int getAnimalCount();//Method defined using lowerCamelCase