A Agr wrote:
When I tried to call method as it printed "Var args method" as output . But why didn't it give compiler error as in printUs method takes 2 arguments and i am calling method with just 1 argument.
It is because you can collect zero elements into the var-args array. In your method, print args.length and see what you get (when you call with only one argument that should be 0.)
That also means that if your method were printUS(
String... args) you would be able to call it without any arguments.