CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    How can I use variable parameters in Java method?

    In C/C++, the number of parameters in a function can be variable, I don't see any similiar feature in Java. So how can I implement it in Java?

    Thanks,
    Laurence


  2. #2
    Join Date
    Apr 1999
    Posts
    4

    Re: How can I use variable parameters in Java method?

    That functionality in Java does not exist. You could create multiple overloaded methods, but that would stilll require you to manually code them. The only option you really have for passing an unspecified number of parameters to a method is by using a Vector (if you're using multiple class types), or an array of the specified type, and then parsing the vector/array from within the method.


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured