public MyParameterizedFunction(String param1, int param2)
{
this(param1, param2, false);
}
public MyParameterizedFunction(String param1, int param2, boolean param3)
{
//use all three parameters here
}
There's a code like this. In c++,
void MyParameterizedFunction(String param1, int param2, bool param3=false);
You can do this I thought it would work in Java
java default-value parameter method
Not in Java. But if you use Build Pattern, you can do it similarly.
Student s1 = new StudentBuilder().name("Eli").buildStudent();
Student s2 = new StudentBuilder()
.name("Spicoli")
.age(16)
.motto("Aloha, Mr Hand")
.buildStudent();
This is how you use it. Please refer to it
© 2024 OneMinuteCode. All rights reserved.