functions
Hmm. Hi all :)
Ok lets go to question. Lets say i want to write function with unknown number of arguments.
In C++ was something like this
void first(int abst, ...)
{
}
how to do this in java. I need this for SQL queries.
And yah. Sorry for my crappy english skills.
Thx for answers.
[338 byte] By [
ULUMULUa] at [2007-11-27 11:14:33]

> Lets say i want to write function with unknown number of arguments.
Pre-Java 5, you would encapsulate those arguments in an object or array. Java 5 and later allow the use of "varargs".
http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html
~
> Hmm. Hi all :)
> Ok lets go to question. Lets say i want to write
> function
We call them methods. You should call them methods too because it will be less confusing.
>with unknown number of arguments.
This can be done http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html
> I need this for SQL queries.
Hmmmm. This doesn't sound like a good reason to use varargs to me. Have you considered using a Collection of some sort instead?
Thx for quick replay.
Now going to look after varargs and collections.
You know i need this for sql query. lets say to create table or smth. and u never know what size it could be, right.