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 do you pass an optional parameter in typescript?

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  Yerli otomobil fabrikası ne zaman açılacak?

Leave a Reply

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