hey ravi
this is really an interesting question
I am really attracted to a question like this
what I can infer from the question is that
when we are passing nothing to a method that takes an var-arg or the array type as parameter, then also the var-arg takes it as zero argument
I think so
even in the main method that we write in programs has the var-arg argument (
String... args) or the (String [] args)
these arguments are meant to come from the command line isn't it
even when we do not pass any command line argument to the program it runs perfectly
isn't it?
now isn't it like calling the main method as follows, with no string arguments at all?
Now I tried to modify your problem here and found something interesting
I printed out the array length after each operation and see what I found
here is the code
when we call printArray(); i.e. method with no arguments, then also some array with no elements in it gets passed as in the main method which takes String arguments
when we print the size of the array in the method it says that size is 0 i.e it has accepted the array and when we print the object then it prints the usual hashcode representation of the object
well let us get it in short
but what I found more interesting is
husshhhhhhhh!!
thanks for the question Ravi got many things from it
happy preparation