Java alternative for C # code

I have a function with the following declaration in C #. This allows me to call a function without providing a value for the variable expectedDisplayValue

. The function will automatically initialize the variable to ""

. I want a similar declaration in java. How can i do this?

public bool VerifyControlState(string identifier,string controltype, ButtonProperty buttonProperty, string expectedDisplayValue = "");

      

+3


source to share


1 answer


The Java framework handles this through function overloading. Basically, create a function that doesn't have expectedDisplayValue

as a parameter, and that function will call VerifyControlState (identifier, controltype, buttonProperty, "");



See Does Java Support Provide Default Parameter Values? for more details.



+2


source







All Articles