Are default parameter values supported by Java?
It is not possible in Java
,but we can use the Builder Pattern, which is said this Stack Overflow answer.
As described in the answer reference, the Builder Pattern lets you write code like
Student s1 = new StudentBuilder().name("Eli").buildStudent();
Student s2 = new StudentBuilder()
.name("Spicoli")
.age(16)
.motto("Aloha, Mr Hand")
.buildStudent();
in which some fields can have default values or otherwise be optional.
No. This feature is not supported in Java.
Does Java support default parameter values?