It is not supported but there are several options like using parameter object pattern with some syntax sugar:
public class Foo() {
private static class ParameterObject {
int param1 = 1;
String param2 = "";
}
public static void main(String[] args) {
new Foo().myMethod(new ParameterObject() {{ param1 = 10; param2 = "bar";}});
}
private void myMethod(ParameterObject po) {
}
}
In this sample we construct ParameterObject
with default values and override them in class instance initialization section { param1 = 10; param2 = "bar";}