Bookmark Topic Watch Topic
  • New Topic

syntax of Methods with Variable Argument Lists (var-args)  RSS feed

 
mangpal singh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
Its been given in the book: SCJP5 ,Kaithy seirra and Bert Bates:

Basic syntax :To declare a method using a var-arg parameter, you follow the
type with an ellipsis (...), a space, and then the name of the array that will hold the parameters received.

Observation:Compiling on java5 compiler , I got that there is no need to specify a space as such. Could anyone please update.The sample method i compiled
public void fact(int y,int...x){};
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Report post to moderator
Duplicated topic. Other is in SCJP. Suggest closing this.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!