Default Methods is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Default Methods
| API ID | CountDeclMethodDefault |
| Targets | Architectures Classes Files Project |
| Languages | Java |
| Categories | Method Counts Object Oriented |
| Cost | Query |
Number of local default methods.
A default method (also called package-private) has no explicit public, private, or protected modifier in Java, making it accessible only from other classes in the same package.
For example:
public class sample {
public void publicMethod() {
}
void defaultMethod() {
}
private void privateMethod() {
}
}
defaultMethod() has no access modifier, giving CountDeclMethodDefault = 1. publicMethod() and privateMethod() have explicit modifiers, so neither counts here.
See Public Methods, Protected Methods, and Private Methods for the access levels shared with C++, C#, and Java, and Internal Methods/Protected Internal Methods for C#'s additional access levels.
Targets By Language:- Java: Project, File, Class, Interface