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 New type of var-args syntax (at least to me) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "New type of var-args syntax (at least to me)" Watch "New type of var-args syntax (at least to me)" New topic
Author

New type of var-args syntax (at least to me)

Max Vandenburg
Ranch Hand

Joined: Mar 09, 2006
Posts: 51
recently i come accross the following question

Given:

1. class Voop {
2. public static void main(String [] args) {
3. doStuff(1);
4. doStuff(1,2);
5. }
6. // insert code here
7. }

Which, inserted independently at line 6, will compile? (Choose all that apply.)

A.static void doStuff(int... doArgs) { }
B.static void doStuff(int[] doArgs) { }
C.static void doStuff(int doArgs...) { }
D.static void doStuff(int... doArgs, int y) { }
E.static void doStuff(int x, int... doArgs) { }


answer is A & E

my question is can anyone point me to a right page which explains to me about this "new" var-args syntax


MV
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
http://java.sun.com/developer/JDCTechTips/2005/tt0104.html
Max Vandenburg
Ranch Hand

Joined: Mar 09, 2006
Posts: 51
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: New type of var-args syntax (at least to me)
 
Similar Threads
var args Vs array : k&b doubt
Gotcha: Varargs spoofs method signature [from Sierra/Bates book]
DOUBT from scjp book
varargs doubt
var-args doubt clarification needed