What is optional parameter in Java?

There are no optional parameters in Java . What you can do is overloading the functions and then passing default values. void SomeMethod(int age, String name) { // } // Overload void SomeMethod(int age) { SomeMethod(age, “John Doe”); }

Sizin İçin Seçtik  How much is rm10 000 in dollars?

Leave a Reply

Your email address will not be published. Required fields are marked *

What is optional parameter in Java?

There are no optional parameters in Java . What you can do is overloading the functions and then passing default values. void SomeMethod(int age, String name) { // } // Overload void SomeMethod(int age) { SomeMethod(age, “John Doe”); }

Sizin İçin Seçtik  What is a default parameter value?

Leave a Reply

Your email address will not be published. Required fields are marked *