Anayonkar Shivalkar wrote:This is because, var args is nothing but an array of arguments.
e.g. 'int... args' is an array of int.
So, here, you are having two methods, with same name, same return type and same arguments - which is not method overloading, but it is duplicate method definition and hence the compile time error.
Both are not same if they are then second program should work with same argument.
Output:- succeed
Now watch
Output:-compile error