Overloading a constructor or a method so it takes an extra argument based upon some specific requirement can result in duplicate code. For instance, a project that contains a lot of modules may have a requirement from a module to take to extra argument. To avoid this, pass “null” to the overloaded constructor:
Class Test { Test(String mgs){ Test("data",null); // will call the Test(String mgs, Locale locale) } Test(String mgs, Locale locale){ }}