This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes var-args Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "var-args" Watch "var-args" New topic


gaurav gupta sitm
Ranch Hand

Joined: Jun 19, 2011
Posts: 47

go(int... z[]) //illegal
go(int[]... z) //legal

why ?
Henry Wong

Joined: Sep 28, 2004
Posts: 20165

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.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
I agree. Here's the link:
subject: var-args
jQuery in Action, 3rd edition