Class names and function names
Use upper case letters as word separators, lower case for the rest of a word
First character in a name is upper case
- Example
ThisIsMyClass();
ThisIsMyFunction();
Use upper case letters as word separators, lower case for the rest of the word
First character in a name is lower case
- Example
public static final int SIZE = 3;
No spaces at in the beginning and end of parantheses
- Example
Do: (i + 1)
Don't: ( i + 1 )
Spaces before and after brackets and parantheses
- Example
Do: x = 2 * (y + 1) - 3;
Don't: x = 2 *(y+1)-3;
Put space before the loops parantheses
Put brace associated with a control statement on the next line
Indented to the same level as the control statement
Statements within the braces are indented to the next level.
Newline is after each loop
- Example
while (x == y)
{
Something();
SomethingElse();
}
SomethingOutsideTheloop();
else and else if is written on the next line
- Example
if (x != 2)
{
Something();
}
else
{
SomethingElse();
}