April 5th, 1999, 09:17 PM
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
Thanks,
Laurence
|
Click to See Complete Forum and Search --> : How can I use variable parameters in Java method? April 5th, 1999, 09:17 PM 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 Jarreth April 5th, 1999, 11:39 PM 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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |