Predict the output of following code. pass 1 2 as command line arguments.
Shouldn't it be "Two arg printUS" followed by the two values? It's not. Answer is "in printUS" followed by the two values. If i call explicitely than it calls specific method for two arg paramers but not when it's from command line. After all here command line is also an array of
Hi Nirav, Acccording to my understanding vararg String ...b is equivalent to String[] b. Before java 1.5 a developer has to explicitly move string values to an array and call the method. Java 1.5 does this for us behind the scene. Your method call is therefore with an array reference not with two String type parameter.Result should be as you got. Hope this helps Tapas
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
Gift giving made easy with the permaculture playing cards