The compiler automatically initializes class fields to their default values before setting them with any initialization values, so there is no need
to explicitly set a field to its default value. Further, under the logic that cleaner code is better code, it’s considered poor style to do so.
Noncompliant code example
public class MyClass {
int count = 0; // Noncompliant
// ...
}
Compliant solution
public class MyClass {
int count;
// ...
}
Exceptions
final
fields are ignored.