-
Notifications
You must be signed in to change notification settings - Fork 2
1.1.5 Statements
Tomaz Martins edited this page Jul 31, 2015
·
1 revision
Only a variable declaration is permitted per line.
private int sum = 0;
private int firstParcel = 0;
private int secondParcel = 0;
private int thirdParcel = 0;
private String fourthParcel = "";
The following form is considered wrong and is not supported.
private int firstParcel = 0, secondParcel = 0, = 0 thirdParcel, fourthParcel = 0;
All variables must be initialized when they are declared.
When coding Java classes and interfaces, the following formatting rules should be followed:
- No space between a method name and parentheses containing the parameter list.
- Open key "{" at the end of the same line as the declaration statement of the class or interface.
- Lock Key "}" starts a line by itself indented to match its corresponding opening statement. In methods or empty builders the rule should remain, writing a review within the scope of the method / empty constructor with the following words: "Empty Constructor" or "Empty Method".
- The methods are separated by a blank line.
An example of this statement:
public class ExampleClass {
private int sum = 0;
private int firstParcel = 0;
private int secondParcel = 0;
private int thirdParcel = 0;
public ExampleClass () {
/* Empty Constructor. */
}
public int sum () {
sum + = firstParcel secondParcel + thirdParcel;
sum return;
}
public void someMethod (fisrtParameter int, int secondParameter,
thirdParameter int, String fourthParameter) {
/* Write Instructions Here. */
}
}