0

When i run a .JAR ( for example) by the cmd , i can pass the following code : Arg1 Arg2 Arg3 , that will be used by the String[] args parameter. As I can pass any number of strings in this way, then the String [] args behaves like a varargs parameter?

Thanks

themagiciant95
  • 181
  • 1
  • 1
  • 12
  • 1
    In Java [varargs](https://docs.oracle.com/javase/1.5.0/docs/guide/language/varargs.html) behave like arrays in general. From the link, *It is still true that multiple arguments must be passed in an array, but the varargs feature automates and hides the process.* – Elliott Frisch Oct 09 '16 at 14:50
  • No, it behaves as an array - and it did so long before the concept of varargs was introduced in Java. Varargs also behave much like an array, with some added syntactic sugar that is not applicable to invocations from the command line. – Erwin Bolwidt Oct 09 '16 at 14:53
  • The book on which I studied referred to the fact that I can pass any number of string to varags, as if it were not possible with arrays. Anyway thanks – themagiciant95 Oct 09 '16 at 17:07

0 Answers0