
The “camel case” is the practice of writing sentences so that each word or abbreviation in the middle of the sentence begins with a capital letter, without spaces or punctuation. For example: “iPad” and “eBay”.
The camel case is normally used for variable names in computer programming. Some programming styles prefer uppercase and lowercase letters with the first letter capitalized, others do not.
The Camel case is distinct from the Title Case (or Capitalized Case), which capitalizes all words, but maintains the spaces between them. For example: “Hello World”. Use our tool to convert text from lower case to Title Case.
Camel case in Programming Languages:
Java: It consists of compound words or phrases such that each word or abbreviation begins with a capital letter or first word with a lowercase letter, rest all with capital.
-
Classes and Interfaces :
- Class names should be nouns, in mixed case with the first letter of each internal word capitalised. Interfaces name should also be capitalised just like class names.
- Use whole words and must avoid acronyms and abbreviations. Examples:
- interface Car
- class SportCar implements Car
- interface Sport
- class Football implements Sport
-
Methods :
- Methods should be verbs, in mixed case with the first letter lowercase and with the first letter of each internal word capitalised. Examples:
- void changeGear(int newValue);
- void speedUp(int increment);
- void applyBrakes(int decrement);
- Methods should be verbs, in mixed case with the first letter lowercase and with the first letter of each internal word capitalised. Examples:
-
Variables : Variable names should be short yet meaningful.
- Should not start with underscore(‘_’) or dollar sign ‘$’ characters.
- Should be mnemonic i.e, designed to indicate to the casual observer the intent of its use.
- One-character variable names should be avoided except for temporary variables.
- Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters.