Java Coding Conventions — Basics

Camel Case
All class names, method (subroutine) names and variable names must use came case. For example: MyClassName, myMethodName, myVariableName.

Note that:
- Class names must begin with an upper case letter
- Method and variable names must begin with a lower case letter

File name and Class name
The file name must be the same as your public class . For example MyClassName.java and public class MyClassName

Indentation
To make code easier to read and understand use a tab or 4 spaces for each “level” your code is indented.
Here is an example. Note how code is indented further in each time a new block of code starts. Also the end “}” aligns with where “{“ began.

Tip: In Eclipse you can use Source > Format to indent your code.