View RSS Feed

Java Object

Object-oriented programming in Java.

  1. Arbitrary Number of Arguments

    by , 04-26-2012 at 05:17 PM
    A construct known as varargs could be used so that for passage of the arbitrary values number to a method. Varargs can be used when numbers of argument types that shall be passed are not known. This is actually the shorter way for array creation that is done manually.

    For usage of the varargs last parameter type shall be followed (by an ellipsis). Then shall come space, then parameter name. Call method by any number, of that parameter, which will also include none
    Java Code:
    public
    ...