File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes maximum no of arguments passed to a function. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "maximum no of arguments passed to a function. " Watch "maximum no of arguments passed to a function. " New topic
Author

maximum no of arguments passed to a function.

pavanasree vasireddy
Ranch Hand

Joined: Jun 12, 2004
Posts: 34
hello everybody,

I would like to know the maximum no of parameters i can pass in a function.
Is there any limit? I would also like to know the maximum no of dimensions a multi dimensional array can have? Please clarify.


Thanks
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
Looks like the answer for both the questions in 255 (in Java 1.4 at least).

If I pass more than 255 arguments to a method I'm getting


And if I pass declare an array with more than 255 dims, I get

[ September 06, 2004: Message edited by: Mani Ram ]

Mani
Quaerendo Invenietis
pavanasree vasireddy
Ranch Hand

Joined: Jun 12, 2004
Posts: 34
Thanks for the reply. got clarified and i have another question. what would be the suggestable number when you pass parameters. Does it affect performance? what all factors get affected?

Thanks once again.
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
I would say, if you are passing anything more than 10 parameters, then there is something seriously wrong with the design (this number might differ from person to person, but I think no one will suggest anything more than 10 - personally I never had a situation to pass more than 6 parameters)

I think it might cause some performance issues, but I'm not sure. You can test it yourself and see the difference.
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Originally posted by Mani Ram:
I would say, if you are passing anything more than 10 parameters, then there is something seriously wrong with the design (this number might differ from person to person, but I think no one will suggest anything more than 10 - personally I never had a situation to pass more than 6 parameters)
Close The "correct" maximum number is 7 plus or minus two; see this discussion. (Of course it's overly simplistic, but when push comes to shove I am quite serious).

- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: maximum no of arguments passed to a function.
 
Similar Threads
Maximun Heap Size in WAS 7.0
Limit the number of requests Tomcat can accept
retrieve nth salary thru optimized sql query
How to check how many array elements are set in function
Maximum number of threads for a servlet