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  Does C# have default parameters?

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  16 Mbit internetin upload ve download hızları kaç olmalı?

Leave a Reply

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