Java-Variable Length Arguments(Method Overloading)

Variable Length Arguments (Method Overloading) Just like normal methods, java ¬†provides facility to overload vararg¬†methods also. You can overload a method with a variable length arguments as long as the parameters for the methods differ in type or order. For example : void varArgsTest(int…v){} void varArgsTest(boolean…v){} void varArgsTest(String…v){} The types of its varargs parameter can … Read more…

Java-Method Overloading

Method Overloading Two or more methods in a class with the same name but different parameter. This technique is called method overloading. Method overloading is used when objects are required to perform similar tasks but using different input parameters. When we call a method in an object, Java matches up the method name first and … Read more…