|
-
April 5th, 1999, 09:17 PM
#1
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
-
April 5th, 1999, 11:39 PM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|