| Author |
Meaning of "int... j"
|
Suresh Rajadurai
Ranch Hand
Joined: Feb 22, 2007
Posts: 58
|
|
Hi, I am preparing for Java certification, I came across a method declaration in a mock question. public void methodX(int i, int... j) Can anybody explain the meaning of "int... j"? Thanks.
|
 |
Freddy Wong
Ranch Hand
Joined: Sep 11, 2006
Posts: 959
|
|
Take a look at this article. http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html
|
SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
In short, it means "int[] i" with the difference that when calling this method, you don't need to explicitly create the array. For example: In the last four lines, the compiler creates an array for you. In the last case, this will be an empty array.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Meaning of "int... j"
|
|
|