This style guide is for Java programming for the Moneybags project.
This style is primarily based on Google's Java Styleguide.
Text is indented with 2 spaces
if (something) {
// logic here
} else if (somethingElse) {
// different logic here
} else {
// even more different
}
Private member variables are prefixed with m_
private int m_age = 30;
Member variables use camelCase:
public String firstName = "Brad";
Constants are in ALL_CAPS with underscores to separate words:
private static final String APP_VERSION = "1.0.0";
Methods names use camelCase:
private void doSomething() {}
Brackets are as such:
Do:
private void doSomething() {
// happy days
}
Don't:
private void doSomething()
{
// this is not right
}
Fall through is fine as long as there is a comment to inform that it is intentional:
switch (dayOfWeek) {
case "Saturday":
// Intentional fall-through
case "Sunday":
return "good";
default:
return "not good";
}
Interfaces are prefixed with I
:
public interface IMyInterface