0 votes
in JAVA by
Name couple of method overloading best practices in Java?

1 Answer

0 votes
by
Here are some best practices you can follow while overloading a method in Java to avoid confusion with auto-boxing:

a) Don't overload method where one accepts int and other accepts Integer.

b) Don't overload method where number of argument is same and only order of argument is different.

c) Use varargs after overloaded methods has more than 5 arguments.

Related questions

0 votes
asked May 25, 2020 in JAVA by Robindeniel
0 votes
asked Jan 27, 2020 in JAVA by rahuljain1
...