#java
Is there a good way to combine these two setFoodName?
@Acer Whatever the language, shouldn't the function be able to have an 'optional input' so you can set a default if no input is found?
@trinsec
Java
@Acer Looks like Java doesn't have optional parameters. Another reason for me to try to forget this language even exists. ;)
Java does have some tricks to mimic this. Check this page, it gave me some idea about those tricks:https://stackify.com/optional-parameters-java/
The tricks on the page is not applied to constructor or I already applied accessors
QOTO: Question Others to Teach Ourselves An inclusive, Academic Freedom, instance All cultures welcome. Hate speech and harassment strictly forbidden.
@Acer Looks like Java doesn't have optional parameters. Another reason for me to try to forget this language even exists. ;)
Java does have some tricks to mimic this. Check this page, it gave me some idea about those tricks:
https://stackify.com/optional-parameters-java/