If you overload a method with a deformable parameter, you need to be aware that
public class Overloadvarargstest{public void Test (String msg) {System.out.println ("only one string parameter of the test Method");} Overloaded method with deformable parameter public void Test (String ... books) {SYSTEM.OUT.PRINTLN ("* * * parameter variable test method ********");} public static void Main (string[] args) {Overloadvarargs ov=new Overloadvarargs (); Ov.test ();//execution of the first test method Ov.test (" Java programming Idea "," Java Core technology volume ");//Executes the second ov.test (" Nihao ");//Executes the first test method Ov.test (new string[]{" AA "," BB "});//Executes the second Test method}}
In addition, overloading of variable-parameter methods is not recommended because it can reduce the readability of your code!!!
Java overloaded methods with deformable parameters