File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

var-args

 
gaurav gupta sitm
Ranch Hand
Posts: 47
Java Redhat Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
go(int... z[]) //illegal
go(int[]... z) //legal

why ?
 
Henry Wong
author
Marshal
Pie
Posts: 20835
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gaurav gupta sitm wrote:go(int... z[]) //illegal
go(int[]... z) //legal

why ?


Interesting. In the Java Language Specification, both seems to be valid grammar. However, the specification only give details for the simpler identifier -- it doesn't defines what to do if the VariableDeclaratorID has array brackets specified (ie. more than a simpler identifier). Or at least, I could not find where the behavior is defined.

Henry
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic