Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum of number of arguments for varargs in java?

What is the maximum of number of arguments which can be used by a vararg in java ? I believe there should be some limit and it is not infinite.

like image 594
ACS Avatar asked Aug 10 '13 16:08

ACS


1 Answers

A method (including the static class initializer) can have at most 64k. If the arguments are such that they can be pushed with a single bytecode that is 1 byte long each, you can have something about 64000 arguments on a call.

like image 118
Ingo Avatar answered Sep 23 '22 10:09

Ingo