dcsimg
Function with undefinded number of variables
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Michael_Decker
Posted On:   Monday, November 26, 2001 06:25 AM

Hello!
I want to create a function, that has a undefindet number of parameters.
I know, that this is possible in c++, but do anybody know, if it is possible in java, too?

Michael

Re: Function with undefinded number of variables

Posted By:   Luigi_Viggiano  
Posted On:   Monday, November 26, 2001 01:11 PM

pls. check How can I create a method which takes one or more optional parameters? for a comprehensive treatment of this issue.

Re: Function with undefinded number of variables

Posted By:   Steven_Martin  
Posted On:   Monday, November 26, 2001 06:47 AM

You have to define the number of variables per method in a class or interface method member.


Another, more object oriented technique would be the following:



mymethod(Vector mydata)
mymethod(Collection mydata)
mymethod(Object [] mydata)



From my previous work with C++, it lets you get away with murder (or genocide depending on the compiler). I would strongly recommend these methods rather then a undefined number of parameters.
About | Sitemap | Contact