Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Posts
    45
    Rep Power
    0

    Default Variable No. of Arguments

    How can we implement variable no. of arguments within a function in JAVA like in C/C++?

  2. #2
    ShoeNinja's Avatar
    ShoeNinja is offline Senior Member
    Join Date
    Oct 2007
    Posts
    124
    Rep Power
    0

    Default

    Are all your variables of the same class? If they are, you can pass an array or vector. There might be a data type (lists, collections....) that allows you to group objects of different classes but as far as I know, it isn't possible. I had this problem in a project recently that required storing information in a database. We ended up creating a temporary table that stores the variables until we need them.

  3. #3
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    9

    Default

    I guess you are looking for this feature:

    Varargs

    It is added to Java 1.5.

Similar Threads

  1. Arguments in Main
    By CyberFrog in forum New To Java
    Replies: 2
    Last Post: 03-30-2008, 09:37 PM
  2. Finding arguments of Servlet
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-25-2008, 07:04 PM
  3. repetition of 'arguments'(?)
    By Igor in forum New To Java
    Replies: 3
    Last Post: 12-13-2007, 10:08 AM
  4. Printing command line arguments
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-03-2007, 09:27 AM
  5. Java Command Line Arguments In Eclipse IDE
    By JavaForums in forum Eclipse
    Replies: 0
    Last Post: 05-19-2007, 09:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •